From 7a8dd04f8b01db66b3751ab1f137f583c2e9f156 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 13 May 2022 18:14:03 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=AE=A2=E6=9C=8Drequest?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/customerServiceHelpers/request.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/customerServiceHelpers/request.js b/src/customerServiceHelpers/request.js index 3542734..c313248 100644 --- a/src/customerServiceHelpers/request.js +++ b/src/customerServiceHelpers/request.js @@ -2,6 +2,7 @@ import axios from 'axios'; import { WITH_REQUEST_BODY_METHODS } from './constants/http'; import { HTTP_STATUS_CODE_MAP } from './constants/http'; import { notification, message } from 'antd' +import { getSessionRoleData, getUserToken } from '@/utils/session'; // Axios全局配置项 axios.defaults.withCredentials = true //允许带cookie @@ -11,9 +12,9 @@ axios.defaults.headers['Authorization'] = ''; // Axios请求拦截器 axios.interceptors.request.use(function (config) { - config.headers['Authorization'] = window.sessionStorage.getItem('token') ? 'Bearer ' +/* '04152390-74f6-4eed-bd7d-f7110cdae419' */ window.sessionStorage.getItem('token') : null; - config.headers['clientId']='bVS46ElU'; - config.headers['scope']=sessionStorage.getItem('scope')?JSON.parse(sessionStorage.getItem('scope')):''; + config.headers['Authorization'] = getUserToken() == null ? null : getUserToken(); + //config.headers['clientId']='bVS46ElU'; + //config.headers['scope']=sessionStorage.getItem('scope')?JSON.parse(sessionStorage.getItem('scope')):''; return config; }, function (error) { return Promise.reject(error);