Response middleware #2408
Unanswered
clicktodev
asked this question in
Ideas
Replies: 1 comment 3 replies
-
I would make such a transformation close to where you make the actual network request, in the queryFn. It might also make sense to transform this response to an error by rejecting the Promise. That way, reatct-query will transition to an error state (if that fits your use-case, but "not allowed to access the resource" sounds like a good fit for an error) |
Beta Was this translation helpful? Give feedback.
3 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.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm working with API endpoints that either return the expected result or return "not allowed to access this resource", I would like to execute a certain piece of code each time I get the "not allowed" response,
I wanna do this without having to check manually for each request I make from the client, Is there a way to create a function that executes whenever a certain response is returned and apply it to the response of all requests made from the client?
Beta Was this translation helpful? Give feedback.
All reactions