From 730cbc6733b2b17b9493b2df26f1bf9adc09dca8 Mon Sep 17 00:00:00 2001 From: Drew Rautenberg Date: Mon, 3 Feb 2025 10:29:50 -0600 Subject: [PATCH] added notifications and redirect to edit item page --- barkmanui/src/features/inventory/AddItem.tsx | 3 ++- barkmanui/src/features/inventory/EditItem.tsx | 24 ++++++++++++++++++- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/barkmanui/src/features/inventory/AddItem.tsx b/barkmanui/src/features/inventory/AddItem.tsx index 581e430..33be18c 100644 --- a/barkmanui/src/features/inventory/AddItem.tsx +++ b/barkmanui/src/features/inventory/AddItem.tsx @@ -74,7 +74,8 @@ function AddItem() { wrap="wrap"> Add Item - + ; function EditItem() { const params = useParams(); + const navigate = useNavigate(); const editItemForm = useForm({ mode: 'uncontrolled', @@ -54,7 +57,26 @@ function EditItem() { } }); + if (result.ok) { + notifications.show({ + icon: , + color:"teal", + title: "All good!", + message: "Item Updated", + position: 'top-center', + }); + navigate("/inventory"); + + } + if (!result.ok) { + notifications.show({ + icon: , + color:"red", + title: "Bummer!", + message: "Something went wrong", + position: 'top-center', + }); throw new Error('Failed to update inventory item'); }