mutateAsync throwing error in nextjs
const mutation = useMutation({
mutationFn: () => {
throw new Error("djfljafjoijioejfioajoisdjfoijdaiojfo");
},
onSuccess: () => {
// console.log("succk");
},
onError: (err) => {
// console.log("err");
},
});
const onSubmit = async (val) => {
try {
const res = await mutation.mutateAsync(val);
console.log("resssss: ", res);
} catch (error) {
console.log("errrrrr: ", error);
}
};
mutationFn: () => {
throw new Error("djfljafjoijioejfioajoisdjfoijdaiojfo");
},
onSuccess: () => {
// console.log("succk");
},
onError: (err) => {
// console.log("err");
},
});
const onSubmit = async (val) => {
try {
const res = await mutation.mutateAsync(val);
console.log("resssss: ", res);
} catch (error) {
console.log("errrrrr: ", error);
}
};
