Redirect using react-router in redux middleware
问题 I've created a middleware that checks if a request returns an invalid access response. If the status is a 401, I want to redirect the user to the login page Here's the middleware code import React from 'react'; import { push, replace } from 'react-router-redux'; const auth_check = ({ getState }) => { return (next) => (action) => { if(action.payload != undefined && action.payload.status==401){ push('login'); console.log('session expired'); } // Call the next dispatch method in the middleware