|
@@ -13,10 +13,8 @@ const whiteList = ['/login', '/auth-redirect'] // no redirect whitelist
|
|
|
router.beforeEach(async(to, from, next) => {
|
|
|
// start progress bar
|
|
|
NProgress.start()
|
|
|
-
|
|
|
// set page title
|
|
|
document.title = getPageTitle(to.meta.title)
|
|
|
-
|
|
|
// determine whether the user has logged in
|
|
|
const hasToken = getToken()
|
|
|
if (hasToken) {
|
|
@@ -45,7 +43,6 @@ router.beforeEach(async(to, from, next) => {
|
|
|
const accessRoutes = await store.dispatch('permission/generateRoutes', roles)
|
|
|
// dynamically add accessible routes
|
|
|
router.addRoutes(accessRoutes)
|
|
|
-
|
|
|
// hack method to ensure that addRoutes is complete
|
|
|
// set the replace: true, so the navigation will not leave a history record
|
|
|
next({ ...to, replace: true })
|