How to queue requests when refreshing a token using axios request interceptor?
Unanswered
Multiflora rose seed chalcid posted this in #help-forum
Multiflora rose seed chalcidOP
So I am facing this issue that whenever multiple requests are being made, when the access token is expired, all the requests make a POST to get a new access token(I am using JWT tokens) which is not ideal. How do I queue those requests till a refresh token is obtained and then let the requests pass through. I am using request interceptor. I did find guides to solve this using response interceptor but that is not ideal since if the request is denied and get a 401 error, then the state changes which are being made in the try block of that request using api.get or api.post will not happen. How do i solve this?
1 Reply
Multiflora rose seed chalcidOP
This is the code that I have so far:
https://pastebin.com/CwMgky2g
https://pastebin.com/CwMgky2g