other-emerald
other-emerald•2y ago

useCustomMutation doesn't lead into AuthProvider checkAuth and checkError

when using useCustomMutation, it doesn't lead into checkError or even checkAuth. Is this normal? and is there any way to make it go into those two (before api gets called -> mutate -> onFailed -> checkError)
7 Replies
Omer
Omer•2y ago
Hey @ganuzaz , Thank you for contacting us! You're right. I've created PR (https://github.com/refinedev/refine/pull/3356) 🔥
other-emerald
other-emerald•2y ago
ahh ok thanks for the respond
other-emerald
other-emerald•2y ago
GitHub
refine/index.tsx at next · refinedev/refine
Build your React-based CRUD applications, without constraints. - refine/index.tsx at next · refinedev/refine
Omer
Omer•2y ago
Yes, you can try this
const { mutate } = useCustomMutation();
const { mutate: checkError } = useCheckError();

mutate(
{
url: `${API_URL}/categories`,
method: "post",
values: {
title: "New Category",
},
},
{
onError: (error, variables, context) => {
// An error happened!
checkError(error);
},
},
);
const { mutate } = useCustomMutation();
const { mutate: checkError } = useCheckError();

mutate(
{
url: `${API_URL}/categories`,
method: "post",
values: {
title: "New Category",
},
},
{
onError: (error, variables, context) => {
// An error happened!
checkError(error);
},
},
);
other-emerald
other-emerald•2y ago
ok it works, thanks a lot!
Omer
Omer•2y ago
Hey @ganuzaz , We've released @pankod/refine-core@3.94.2 (https://github.com/refinedev/refine/releases/tag/%40pankod%2Frefine-core%403.94.2) 💯
GitHub
Release @pankod/refine-core@3.94.2 · refinedev/refine
Patch Changes #3364 98a1fbec65a Thanks @aliemir! - Changed IResourceComponents from IResourceContext to use React.ComponentType rather than React.FunctionComponent to make it compatible with othe...
other-emerald
other-emerald•2y ago
ok thank you!