Explorar o código

Update request.ts

lex hai 1 ano
pai
achega
07be0d6f10
Modificáronse 1 ficheiros con 3 adicións e 2 borrados
  1. 3 2
      src/utils/request.ts

+ 3 - 2
src/utils/request.ts

@@ -4,6 +4,7 @@ import { useUserStore } from '../store/modules/users';
 import router from '@/router';
 import { eventGlobal } from '.';
 import { storage } from './storage';
+import { ACCESS_TOKEN_ADMIN } from '../store/mutation-types';
 
 export interface SearchInitParams {
   rows?: string | number;
@@ -31,8 +32,8 @@ request.interceptors.request.use(
     let Authorization = userStore.getToken || '';
     // 为了处理课堂乐器后台预览课件的功能
     const authSource = sessionStorage.getItem('authSource');
-    if (authSource === 'admin' && storage.get('authorization')) {
-      Authorization = storage.get('authorization');
+    if (authSource === 'admin' && storage.get(ACCESS_TOKEN_ADMIN)) {
+      Authorization = storage.get(ACCESS_TOKEN_ADMIN);
     }
     const authHeaders: any = {};
     // if (