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
Omer2y ago
Hey @ganuzaz , Thank you for contacting us! You're right. I've created PR (https://github.com/refinedev/refine/pull/3356) 🔥
absent-sapphire
absent-sapphire2y ago
ahh ok thanks for the respond
absent-sapphire
absent-sapphire2y 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
Omer2y 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);
},
},
);
absent-sapphire
absent-sapphire2y ago
ok it works, thanks a lot!
Omer
Omer2y 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...
absent-sapphire
absent-sapphire2y ago
ok thank you!