Skip to content

Commit db1249d

Browse files
committed
👷 Update item edit form data after successful save
1 parent 88c83cc commit db1249d

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

frontend/src/components/Items/EditItem.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import {
1919
type ApiError,
2020
type ItemPublic,
2121
type ItemUpdate,
22+
type ItemsUpdateItemResponse,
2223
ItemsService,
2324
} from "../../client"
2425
import useCustomToast from "../../hooks/useCustomToast"
@@ -47,8 +48,9 @@ const EditItem = ({ item, isOpen, onClose }: EditItemProps) => {
4748
const mutation = useMutation({
4849
mutationFn: (data: ItemUpdate) =>
4950
ItemsService.updateItem({ id: item.id, requestBody: data }),
50-
onSuccess: () => {
51+
onSuccess: (data: ItemsUpdateItemResponse) => {
5152
showToast("Success!", "Item updated successfully.", "success")
53+
reset(data)
5254
onClose()
5355
},
5456
onError: (err: ApiError) => {

0 commit comments

Comments
 (0)