refactor: remove_permission-control
This commit is contained in:
@@ -4,7 +4,7 @@ import NProgress from 'nprogress' // Progress 进度条
|
||||
import 'nprogress/nprogress.css'// Progress 进度条样式
|
||||
import { getToken } from '@/utils/auth' // 验权
|
||||
|
||||
const whiteList = ['/login']
|
||||
const whiteList = ['/login'] // 不重定向白名单
|
||||
router.beforeEach((to, from, next) => {
|
||||
NProgress.start()
|
||||
if (getToken()) {
|
||||
@@ -12,12 +12,8 @@ router.beforeEach((to, from, next) => {
|
||||
next({ path: '/' })
|
||||
} else {
|
||||
if (store.getters.roles.length === 0) {
|
||||
store.dispatch('GetInfo').then(res => {
|
||||
const roles = res.data.role
|
||||
store.dispatch('GenerateRoutes', { roles }).then(() => {
|
||||
router.addRoutes(store.getters.addRouters)
|
||||
next({ ...to })
|
||||
})
|
||||
store.dispatch('GetInfo').then(res => { // 拉取用户信息
|
||||
next()
|
||||
})
|
||||
} else {
|
||||
next()
|
||||
|
||||
Reference in New Issue
Block a user