const { mutate, isPending } = useMutation({
mutationFn: (value: { companyName: string }) => {
return updateClient({ value, clientNo })
},
onSuccess: () => {
toast.success('Cient has been successfuly Updated.')
setEdit(false)
queryClient.invalidateQueries({
queryKey: ['client', clientNo]
})
},
onSettled: () => {
queryClient.invalidateQueries({
queryKey: ['client', clientNo]
})
},
onError: (error) => {
const custom = error as CustomError
toast.error(`${custom?.response?.data}`)
}
})
const onSubmit = async (values: z.infer<typeof clientEditFormSchema>) => {
mutate(values)
}
const { mutate, isPending } = useMutation({
mutationFn: (value: { companyName: string }) => {
return updateClient({ value, clientNo })
},
onSuccess: () => {
toast.success('Cient has been successfuly Updated.')
setEdit(false)
queryClient.invalidateQueries({
queryKey: ['client', clientNo]
})
},
onSettled: () => {
queryClient.invalidateQueries({
queryKey: ['client', clientNo]
})
},
onError: (error) => {
const custom = error as CustomError
toast.error(`${custom?.response?.data}`)
}
})
const onSubmit = async (values: z.infer<typeof clientEditFormSchema>) => {
mutate(values)
}