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
import { createHashHistory } from 'history' // or createBrowserHistory const history = createHashHistory() if (response.status === 403) { history.push('/login') }
ReactTraining/history