|
@@ -8,6 +8,7 @@ import {
|
|
|
} from '@/store/mutation-types';
|
|
|
import { storage } from '@/utils/storage';
|
|
|
import { userLogin, getUserInfo } from '@/api/user';
|
|
|
+import { getAuthForAdmin } from '/src/utils';
|
|
|
|
|
|
export interface IUserState {
|
|
|
token: string;
|
|
@@ -38,9 +39,12 @@ export const useUserStore = defineStore('user-store', {
|
|
|
getToken(): string {
|
|
|
|
|
|
let Authorization = this.token;
|
|
|
- const authSource = sessionStorage.getItem('authSource');
|
|
|
- if (authSource === 'admin' && storage.get(ACCESS_TOKEN_ADMIN)) {
|
|
|
- Authorization = storage.get(ACCESS_TOKEN_ADMIN);
|
|
|
+
|
|
|
+ const userAuth = getAuthForAdmin();
|
|
|
+ if (userAuth.authSource === 'admin') {
|
|
|
+ Authorization = userAuth.Authorization;
|
|
|
+ } else {
|
|
|
+ Authorization = this.token || '';
|
|
|
}
|
|
|
return Authorization;
|
|
|
},
|