|
@@ -117,32 +117,23 @@ router.afterEach((to) => {
|
|
|
}, 200);
|
|
}, 200);
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
-router.roleChange = ({ menus, homePath, authoritiesRouter }) => {
|
|
|
|
|
|
|
+router.roleChange = async ({ menus, homePath, authoritiesRouter }) => {
|
|
|
|
|
+ const currentUser = JSON.parse(sessionStorage['currentUser']);
|
|
|
|
|
+
|
|
|
if (menus && menus.length > 0) {
|
|
if (menus && menus.length > 0) {
|
|
|
router.addRoute(
|
|
router.addRoute(
|
|
|
getMenuRoutes([...menus, ...authoritiesRouter], homePath)
|
|
getMenuRoutes([...menus, ...authoritiesRouter], homePath)
|
|
|
);
|
|
);
|
|
|
- if (router.currentRoute.path == (menus[0].redirect || menus[0].path)) {
|
|
|
|
|
- changeRole({ groupId: store.state.user.info.currentGroupId, roleId: store.state.user.info.currentRoleId }).then(res => {
|
|
|
|
|
- setToken(res)
|
|
|
|
|
- setTimeout(() => {
|
|
|
|
|
- window.location.reload()
|
|
|
|
|
- }, 100);
|
|
|
|
|
- })
|
|
|
|
|
- } else {
|
|
|
|
|
- router.replace({
|
|
|
|
|
|
|
+ if (router.currentRoute.path != (menus[0].redirect || menus[0].path)) {
|
|
|
|
|
+ await router.replace({
|
|
|
path: menus[0].redirect || menus[0].path,
|
|
path: menus[0].redirect || menus[0].path,
|
|
|
- }).then(res => {
|
|
|
|
|
- changeRole({ groupId: store.state.user.info.currentGroupId, roleId: store.state.user.info.currentRoleId }).then(res => {
|
|
|
|
|
- setToken(res)
|
|
|
|
|
- setTimeout(() => {
|
|
|
|
|
- window.location.reload()
|
|
|
|
|
- }, 100);
|
|
|
|
|
- })
|
|
|
|
|
-
|
|
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+ const newToken = await changeRole({ groupId: currentUser.currentGroupId, roleId: currentUser.currentRoleId })
|
|
|
|
|
+ setToken(newToken)
|
|
|
|
|
+ setTimeout(() => {
|
|
|
|
|
+ window.location.reload()
|
|
|
|
|
+ }, 100);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// next({ ...to, replace: true });
|
|
// next({ ...to, replace: true });
|