修改请求代码,在请求数据返回后主动调用history.push('/')即可
useEffect(() => {
if (dispatch) {
dispatch({
type: 'user/fetchCurrent',
});
dispatch({
type: 'menu/getMenuData',
callback(){
history.push('/');
},
});
}
}, []);