|
@@ -6,8 +6,7 @@ import NProgress from 'nprogress';
|
|
|
import VueRouter from 'vue-router';
|
|
import VueRouter from 'vue-router';
|
|
|
import { WHITE_LIST, REDIRECT_PATH, LAYOUT_PATH } from '@/config/setting';
|
|
import { WHITE_LIST, REDIRECT_PATH, LAYOUT_PATH } from '@/config/setting';
|
|
|
import store from '@/store';
|
|
import store from '@/store';
|
|
|
-import { getToken, setToken } from '@/utils/token-util';
|
|
|
|
|
-
|
|
|
|
|
|
|
+import { getToken, setToken, getCurrentUser } from '@/utils/token-util';
|
|
|
import { routes, getMenuRoutes } from './routes';
|
|
import { routes, getMenuRoutes } from './routes';
|
|
|
import { SYSTEM_NAME } from '@/config/setting';
|
|
import { SYSTEM_NAME } from '@/config/setting';
|
|
|
|
|
|
|
@@ -94,8 +93,7 @@ router.afterEach((to) => {
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
router.roleChange = async ({ menus, homePath, authoritiesRouter }) => {
|
|
router.roleChange = async ({ menus, homePath, authoritiesRouter }) => {
|
|
|
- const currentUser = JSON.parse(sessionStorage['currentUser']);
|
|
|
|
|
-
|
|
|
|
|
|
|
+ const currentUser = getCurrentUser()
|
|
|
if (menus && menus.length > 0) {
|
|
if (menus && menus.length > 0) {
|
|
|
router.addRoute(getMenuRoutes([...menus, ...authoritiesRouter], homePath));
|
|
router.addRoute(getMenuRoutes([...menus, ...authoritiesRouter], homePath));
|
|
|
if (router.currentRoute.path != (menus[0].redirect || menus[0].path)) {
|
|
if (router.currentRoute.path != (menus[0].redirect || menus[0].path)) {
|