From f814b6ebacab5fcdfae62f7c0d0793046e6fb3a2 Mon Sep 17 00:00:00 2001 From: chenjinsong <523037378@qq.com> Date: Fri, 25 Aug 2023 14:56:57 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=9B=B4=E6=94=B9=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E7=8A=B6=E6=80=81=E5=88=A4=E6=96=AD=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main.js | 1 + src/utils/http.js | 9 +++------ 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/main.js b/src/main.js index 2a3aaabc..d536b1f7 100644 --- a/src/main.js +++ b/src/main.js @@ -4,6 +4,7 @@ import '@/assets/css/font/iconfont.js' import router from '@/router' import store from '@/store' import App from '@/App.vue' +import '@/utils/http.js' import { hasPermission } from '@/permission' import commonMixin from '@/mixins/common' import { cancelWithChange, noData } from '@/utils/tools' diff --git a/src/utils/http.js b/src/utils/http.js index c897447f..dcfb5262 100644 --- a/src/utils/http.js +++ b/src/utils/http.js @@ -6,7 +6,6 @@ const CancelToken = axios.CancelToken axios.interceptors.request.use(config => { const token = localStorage.getItem(storageKey.token) - // 添加http请求终止方法 const arr = [] const cancelToken = new CancelToken(function executor (c) { @@ -63,11 +62,9 @@ axios.interceptors.response.use( if (licenceErrorCode.indexOf(response.data.code) !== -1) { localStorage.removeItem(storageKey.token) window.location.href = '/' - } else if (response.status === 200) { - if (accountErrorCode.indexOf(response.data.code) !== -1) { - localStorage.removeItem(storageKey.token) - window.location.href = '/' - } + } else if (accountErrorCode.indexOf(response.data.code) !== -1) { + localStorage.removeItem(storageKey.token) + window.location.href = '/' } return response },