|
|
@@ -122,16 +122,27 @@ router.roleChange = ({ menus, homePath, authoritiesRouter }) => {
|
|
|
router.addRoute(
|
|
|
getMenuRoutes([...menus, ...authoritiesRouter], homePath)
|
|
|
);
|
|
|
-
|
|
|
- router.push({
|
|
|
- path: menus[0].redirect || menus[0].path,
|
|
|
- }).then(res => {
|
|
|
+ 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)
|
|
|
- window.location.reload()
|
|
|
+ setTimeout(() => {
|
|
|
+ window.location.reload()
|
|
|
+ }, 100);
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ router.replace({
|
|
|
+ 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);
|
|
|
+ })
|
|
|
+
|
|
|
})
|
|
|
+ }
|
|
|
|
|
|
- })
|
|
|
}
|
|
|
|
|
|
// next({ ...to, replace: true });
|