How to merge SWR Config onError and trigger onError #2340
Unanswered
PedroLucasSilva
asked this question in
Q&A
Replies: 1 comment
-
@PedroLucasSilva const { onError } = useSWRConfig();
const { trigger } = useSWRMutation('/api/user', updateUser, {
onError(...args) {
onError(...args);
// put your custom error handling
}
)); |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I noticed that when I use the trigger's onError (useSWR Mutation) it replaces the onError configured in SWRConfig. Is it possible to combine the two instead? I want to use the one configured in SWRConfig for generic errors (500) and the ones configured in the trigger to handle specific errors.
Beta Was this translation helpful? Give feedback.
All reactions