From 971a798af02cf2443b113ad1e1b4a870f6d0ef0c Mon Sep 17 00:00:00 2001 From: keannu125 Date: Tue, 7 Mar 2023 23:55:03 +0800 Subject: [PATCH] Refresh logs if new product is added or removed --- src/Routes/Logs/Logs.tsx | 18 +++--------------- src/Routes/NewProduct/NewProduct.tsx | 1 + 2 files changed, 4 insertions(+), 15 deletions(-) diff --git a/src/Routes/Logs/Logs.tsx b/src/Routes/Logs/Logs.tsx index 528671a..12d23d9 100644 --- a/src/Routes/Logs/Logs.tsx +++ b/src/Routes/Logs/Logs.tsx @@ -70,19 +70,13 @@ export default function Logs() { - Log ID + Product Changed - Product ID + Quantity Changed To - Product - - - Quantity - - - User + Transaction by Timestamp @@ -95,12 +89,6 @@ export default function Logs() { key={row.id} sx={{ "&:last-child td, &:last-child th": { border: 0 } }} > - - {row.history_id} - - - {row.id} - {row.name} diff --git a/src/Routes/NewProduct/NewProduct.tsx b/src/Routes/NewProduct/NewProduct.tsx index 82ea3dd..64a31ba 100644 --- a/src/Routes/NewProduct/NewProduct.tsx +++ b/src/Routes/NewProduct/NewProduct.tsx @@ -17,6 +17,7 @@ export default function NewProduct() { mutationFn: AddProduct, onSuccess: () => { queryClient.invalidateQueries("products"); + queryClient.invalidateQueries("logs"); }, }); return (