Do the link jump in the axios interceptor in the react code

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);
});
Mar.14,2021

//react-router-dom (rrouter v4),browercreateHashHistorycreateBrowerHistory
import {createHashHistory} from 'history';
const history = createHashHistory();
history.push('');

//react-router v3browerhashHistorybrowerHistory
import {hashHistory} from 'react-router';
hashHistory.push('');

import {HashRouter} from 'react-router-dom'
const router = new HashRouter()
router.history.push('/')

recently also encountered = _, =
but my needs are not very complicated, so I violently location.href='xxx' jumped
and waited for other veteran drivers to answer


ask how to configure the interceptor in the react project

configure a separate js file and introduce it into index.js

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1eac852-20d7.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1eac852-20d7.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?