this is the axios interceptor used in React. How to do a react route transfer in the interceptor?
import Axios from "axios"
Axios.interceptors.request.use(function (config) {
let token = window.localStorage.token;
if (token) {
config.headers.Authorization = `token ${token}`
}
return config
}, function (error) {
return Promise.reject(error);
});
Axios.interceptors.request.use(function (config) {
return config
}, function (error) {
// react
return Promise.reject(error);
});