2

I have searched a lot but couldnot find a definitive answer. What i want in the axios to redirect me to the login page whenever 401 arrives and for the 403 just call the API for a new access token and re-request all the failed requests.

I coulnot find a way to route in the interceptor of axios and i dont want to route by refreshing the page as it would violate the SPA.

For the 403 i coulnot find a way way to re-request all the failed request.

PuskarShestha
  • 755
  • 1
  • 7
  • 19
  • could you provide some code ? Probably you need to create the history that your router uses in a module - that way it can be exported (and imported) where you define your interceptor.. That is feasible if using react router v4 https://stackoverflow.com/questions/42672842/how-to-get-history-on-react-router-v4 not quite sure what are you using for routing though – Gonzalo.- Dec 08 '18 at 16:04

0 Answers0