Replies: 1 comment
-
It seems that the best solution is just to clear cookies and call redirect:
|
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.
Uh oh!
There was an error while loading. Please reload this page.
-
I have auth with axios and interceptors and I am having an issue with the user logout.
When an accessToken is invalidated I am executing the revalidation with a refreshToken. When the refreshToken is also invalid, I want to logout a user, but I am not sure how to stop/clear all the requests which are triggered in the app by useSWR with the axios fetcher.
What is the best practice to do this?
Currently, I am calling reject on all triggered requests with
onExpired
- but this still caches all requests so after users re-login there are still previous data. If I do not reject that request it stuck in the loading.I have also tried to call
cache.clear()
fromimport {cache} from 'swr'
Beta Was this translation helpful? Give feedback.
All reactions