fix: 更改接口状态判断方式

This commit is contained in:
chenjinsong
2023-08-25 14:56:57 +08:00
parent 72fdb13295
commit f814b6ebac
2 changed files with 4 additions and 6 deletions

View File

@@ -4,6 +4,7 @@ import '@/assets/css/font/iconfont.js'
import router from '@/router' import router from '@/router'
import store from '@/store' import store from '@/store'
import App from '@/App.vue' import App from '@/App.vue'
import '@/utils/http.js'
import { hasPermission } from '@/permission' import { hasPermission } from '@/permission'
import commonMixin from '@/mixins/common' import commonMixin from '@/mixins/common'
import { cancelWithChange, noData } from '@/utils/tools' import { cancelWithChange, noData } from '@/utils/tools'

View File

@@ -6,7 +6,6 @@ const CancelToken = axios.CancelToken
axios.interceptors.request.use(config => { axios.interceptors.request.use(config => {
const token = localStorage.getItem(storageKey.token) const token = localStorage.getItem(storageKey.token)
// 添加http请求终止方法 // 添加http请求终止方法
const arr = [] const arr = []
const cancelToken = new CancelToken(function executor (c) { const cancelToken = new CancelToken(function executor (c) {
@@ -63,12 +62,10 @@ axios.interceptors.response.use(
if (licenceErrorCode.indexOf(response.data.code) !== -1) { if (licenceErrorCode.indexOf(response.data.code) !== -1) {
localStorage.removeItem(storageKey.token) localStorage.removeItem(storageKey.token)
window.location.href = '/' window.location.href = '/'
} else if (response.status === 200) { } else if (accountErrorCode.indexOf(response.data.code) !== -1) {
if (accountErrorCode.indexOf(response.data.code) !== -1) {
localStorage.removeItem(storageKey.token) localStorage.removeItem(storageKey.token)
window.location.href = '/' window.location.href = '/'
} }
}
return response return response
}, },
error => { error => {