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>
<TableRow>
<TableCell style={{ ...styles.text_white, ...styles.text_M }}>
Log ID
Product Changed
</TableCell>
<TableCell style={{ ...styles.text_white, ...styles.text_M }}>
Product ID
Quantity Changed To
</TableCell>
<TableCell style={{ ...styles.text_white, ...styles.text_M }}>
Product
</TableCell>
<TableCell style={{ ...styles.text_white, ...styles.text_M }}>
Quantity
</TableCell>
<TableCell style={{ ...styles.text_white, ...styles.text_M }}>
User
Transaction by
</TableCell>
<TableCell style={{ ...styles.text_white, ...styles.text_M }}>
Timestamp
@ -95,12 +89,6 @@ export default function Logs() {
key={row.id}
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 }}>
{row.name}
</TableCell>

View file

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