|
@@ -2,7 +2,7 @@ import { isNavigationFailure, Router } from 'vue-router';
|
|
|
import { useUserStore } from '@/store/modules/users';
|
|
|
import { storage } from '@/utils/storage';
|
|
|
import { PageEnum } from '@/enums/pageEnum';
|
|
|
-import { ACCESS_TOKEN } from '@/store/mutation-types';
|
|
|
+import { ACCESS_TOKEN, ACCESS_TOKEN_ADMIN } from '@/store/mutation-types';
|
|
|
|
|
|
const LOGIN_PATH = PageEnum.BASE_LOGIN;
|
|
|
|
|
@@ -63,7 +63,11 @@ export function createRouterGuards(router: Router) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- const token = storage.get(ACCESS_TOKEN);
|
|
|
+ let token = storage.get(ACCESS_TOKEN);
|
|
|
+ const authSource = sessionStorage.getItem('authSource');
|
|
|
+ if (authSource === 'admin' && storage.get(ACCESS_TOKEN_ADMIN)) {
|
|
|
+ token = storage.get(ACCESS_TOKEN_ADMIN);
|
|
|
+ }
|
|
|
// console.log(token, 'access token');
|
|
|
if (!token) {
|
|
|
// You can access without permissions. You need to set the routing meta.ignoreAuth to true
|