liyongli 4 months ago
parent
commit
51703be3ec
1 changed files with 2 additions and 2 deletions
  1. 2 2
      src/router/index.ts

+ 2 - 2
src/router/index.ts

@@ -97,13 +97,13 @@ router.beforeEach((to, from, next) => {
     localStorage.getItem('user') || '{role: { menus: [] }}',
   )
   const haveAuth = checkAuth(menus, to.path)
-  if (!token || !haveAuth) {
+  if (!token || !haveAuth.path) {
     localStorage.removeItem('phone')
     localStorage.removeItem('token')
     localStorage.removeItem('user')
     return next('/login')
   }
-  if (to.path === '/') return next(token ? '/authorized/originality' : '/login')
+  if (to.path === '/') return next(token ? haveAuth.path : '/login')
   next()
 })