浏览代码

Update request.ts

lex 1 年之前
父节点
当前提交
07be0d6f10
共有 1 个文件被更改,包括 3 次插入2 次删除
  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 (