I would like to handle, for example, expired access token error for all queries that currently running in my react app.
- I need to catch expired access token error globaly
- cancel other queries which soon will throw same error
- Update access token in context
- Invalidate all failed/canceled queries and refetch with new access token.
Is there a way to do it provided by React Query? Could you show simple example how to achieve that?
useQuery
and handle your custom logic there. – Gayegayel