♻️ Tweaks in frontend (#1273)
This commit is contained in:
@@ -17,6 +17,7 @@ import { type SubmitHandler, useForm } from "react-hook-form"
|
||||
|
||||
import { type ApiError, type ItemCreate, ItemsService } from "../../client"
|
||||
import useCustomToast from "../../hooks/useCustomToast"
|
||||
import { handleError } from "../../utils"
|
||||
|
||||
interface AddItemProps {
|
||||
isOpen: boolean
|
||||
@@ -49,8 +50,7 @@ const AddItem = ({ isOpen, onClose }: AddItemProps) => {
|
||||
onClose()
|
||||
},
|
||||
onError: (err: ApiError) => {
|
||||
const errDetail = (err.body as any)?.detail
|
||||
showToast("Something went wrong.", `${errDetail}`, "error")
|
||||
handleError(err, showToast)
|
||||
},
|
||||
onSettled: () => {
|
||||
queryClient.invalidateQueries({ queryKey: ["items"] })
|
||||
|
||||
Reference in New Issue
Block a user