fix: 跳转不存在的路由空白页面问题修复
Former-commit-id: c797a3a474df0d0ec78daafff27f52e47d1d3777
This commit is contained in:
@@ -9,7 +9,6 @@ NProgress.configure({ showSpinner: false }); // 进度环显示/隐藏
|
||||
const whiteList = ['/login', '/auth-redirect'];
|
||||
|
||||
router.beforeEach(async (to, from, next) => {
|
||||
console.log('beforeEach', to);
|
||||
NProgress.start();
|
||||
const { user, permission } = useStore();
|
||||
const hasToken = user.token;
|
||||
@@ -21,7 +20,11 @@ router.beforeEach(async (to, from, next) => {
|
||||
} else {
|
||||
const hasGetUserInfo = user.roles.length > 0;
|
||||
if (hasGetUserInfo) {
|
||||
next();
|
||||
if (to.matched.length === 0) {
|
||||
from.name ? next({ name: from.name }) : next('/');
|
||||
} else {
|
||||
next();
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
await user.getUserInfo();
|
||||
|
||||
Reference in New Issue
Block a user