From ecfa4a310b82a9a5e9d91e34cb22c3248f978675 Mon Sep 17 00:00:00 2001 From: Raod <1130305001@qq.com> Date: Fri, 25 Jun 2021 13:11:17 +0800 Subject: [PATCH] cors --- report-ui/src/api/axios.js | 1 - report-ui/src/utils/request.js | 4 +--- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/report-ui/src/api/axios.js b/report-ui/src/api/axios.js index 458975f3..93561583 100644 --- a/report-ui/src/api/axios.js +++ b/report-ui/src/api/axios.js @@ -10,7 +10,6 @@ const service = axios.create({ timeout: 60000, headers: { 'Content-Type': 'application/json', - 'Authorization': getItem('token') } }) diff --git a/report-ui/src/utils/request.js b/report-ui/src/utils/request.js index 7744512e..cd85d485 100644 --- a/report-ui/src/utils/request.js +++ b/report-ui/src/utils/request.js @@ -12,9 +12,7 @@ const service = axios.create({ // request拦截器 service.interceptors.request.use( config => { - if (store.getters.token) { - config.headers['X-Token'] = getToken() // 让每个请求携带自定义token 请根据实际情况自行修改 - } + config.headers['Authorization'] = (getToken() == null || getToken() == undefined) ? '': getToken() return config }, error => {