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 },