if (response.data.protocol === '102002') {
setTimeout(() => {
load.tryHideFullScreenLoading()
}, 6000)
}
// 添加respone拦截器
service.interceptors.response.use(
response => {
const res = {} // eslint-disable-line no-unused-vars
if (response.data.protocol === '102002') {
setTimeout(() => {
load.tryHideFullScreenLoading()
}, 6000)
} else {
load.tryHideFullScreenLoading()
if (!response.data.sucess && response.config.responseType !== 'arraybuffer') { // eslint-disable-line no-unused-vars
if (isErrorResponse(response.data.paramBody)) {
console.log(response.data)
store.dispatch('user/logout')
router.replace('/login')
return response.data
}
}
}
console.log(response)
if (response.status === 200) {
return response.data
} else {
console.log('出错')
return response.data
}
},
error => {
load.tryHideFullScreenLoading()
if (error.response && error.response.status === 404) {
console.log('eeeeeee')
}
return Promise.reject(error.response)
}
)
网友评论