I want to make a redirection in axios interceptors when receiving a 403 error. But how can I access the history outside React components ?
In Navigating Programatically
The accepted answer doesnt solve my problem. After spending time in axios and tickets around interceptor not triggering, i found, axios doesnt support decorating interceptor globally like it is described above. for future readers, please keep in mind that, axios has tagged this global interceptor
as feature. so maybe we will get it in the future realse. for ref: https://github.com/axios/axios/issues/993.
I do have a single axios instance for all the api call, so i solved defining interceptor in it.