From db1249d0cf3d32a42378ca035b477c1140c75820 Mon Sep 17 00:00:00 2001 From: flipkick <167208+flipkick@users.noreply.github.com> Date: Thu, 12 Dec 2024 17:36:09 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=91=B7=20Update=20item=20edit=20form=20da?= =?UTF-8?q?ta=20after=20successful=20save?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/components/Items/EditItem.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/frontend/src/components/Items/EditItem.tsx b/frontend/src/components/Items/EditItem.tsx index 3d40cdc03a..3cc8b653b0 100644 --- a/frontend/src/components/Items/EditItem.tsx +++ b/frontend/src/components/Items/EditItem.tsx @@ -19,6 +19,7 @@ import { type ApiError, type ItemPublic, type ItemUpdate, + type ItemsUpdateItemResponse, ItemsService, } from "../../client" import useCustomToast from "../../hooks/useCustomToast" @@ -47,8 +48,9 @@ const EditItem = ({ item, isOpen, onClose }: EditItemProps) => { const mutation = useMutation({ mutationFn: (data: ItemUpdate) => ItemsService.updateItem({ id: item.id, requestBody: data }), - onSuccess: () => { + onSuccess: (data: ItemsUpdateItemResponse) => { showToast("Success!", "Item updated successfully.", "success") + reset(data) onClose() }, onError: (err: ApiError) => {