Refresh logs if new product is added or removed

This commit is contained in:
keannu125 2023-03-07 23:55:03 +08:00
parent 52f115c610
commit 971a798af0
2 changed files with 4 additions and 15 deletions

View file

@ -70,19 +70,13 @@ export default function Logs() {
<TableHead> <TableHead>
<TableRow> <TableRow>
<TableCell style={{ ...styles.text_white, ...styles.text_M }}> <TableCell style={{ ...styles.text_white, ...styles.text_M }}>
Log ID Product Changed
</TableCell> </TableCell>
<TableCell style={{ ...styles.text_white, ...styles.text_M }}> <TableCell style={{ ...styles.text_white, ...styles.text_M }}>
Product ID Quantity Changed To
</TableCell> </TableCell>
<TableCell style={{ ...styles.text_white, ...styles.text_M }}> <TableCell style={{ ...styles.text_white, ...styles.text_M }}>
Product Transaction by
</TableCell>
<TableCell style={{ ...styles.text_white, ...styles.text_M }}>
Quantity
</TableCell>
<TableCell style={{ ...styles.text_white, ...styles.text_M }}>
User
</TableCell> </TableCell>
<TableCell style={{ ...styles.text_white, ...styles.text_M }}> <TableCell style={{ ...styles.text_white, ...styles.text_M }}>
Timestamp Timestamp
@ -95,12 +89,6 @@ export default function Logs() {
key={row.id} key={row.id}
sx={{ "&:last-child td, &:last-child th": { border: 0 } }} sx={{ "&:last-child td, &:last-child th": { border: 0 } }}
> >
<TableCell style={{ ...styles.text_white, ...styles.text_S }}>
{row.history_id}
</TableCell>
<TableCell style={{ ...styles.text_white, ...styles.text_S }}>
{row.id}
</TableCell>
<TableCell style={{ ...styles.text_white, ...styles.text_S }}> <TableCell style={{ ...styles.text_white, ...styles.text_S }}>
{row.name} {row.name}
</TableCell> </TableCell>

View file

@ -17,6 +17,7 @@ export default function NewProduct() {
mutationFn: AddProduct, mutationFn: AddProduct,
onSuccess: () => { onSuccess: () => {
queryClient.invalidateQueries("products"); queryClient.invalidateQueries("products");
queryClient.invalidateQueries("logs");
}, },
}); });
return ( return (