Commit 38c6d146 authored by 前端-许佳敏's avatar 前端-许佳敏

修复从登录页首次进入无路由信息

parent cc7de3c4
......@@ -70,10 +70,12 @@ export function render(oldRender: Function) {
token: data.token
})
setRouters(data.urls)
oldRender()
})
} else {
history.push('/user/login')
oldRender()
}
oldRender()
}
/**
......@@ -84,15 +86,13 @@ export function render(oldRender: Function) {
* @param {*} { routes, matchedRoutes, location, action }
*/
export function onRouteChange({ routes, matchedRoutes, location, action }) {
console.log(`当前可访问的路由为`)
console.log(routes, matchedRoutes, location)
console.log('onRouteChange')
if (isDev) {
return;
}
if (whiteLists.includes(location.pathname)) return;
const routeAuthUrls = getRouters()
console.log(routeAuthUrls, "routeAuthUrls")
// 是否登录
if (getAuth()) {
if (routeAuthUrls.includes(location.pathname)) {
......
......@@ -23,7 +23,7 @@ const LoginWrap: React.FC = () => {
token: data.token
})
setRouters(data.urls)
history.push('/memberCenter/home')
window.location.href = '/memberCenter/home'
})
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment