Update axios.js

main
wangqiujuan0808 2024-06-25 19:31:22 +08:00
parent 60261c9aac
commit 029ab94f06
1 changed files with 5 additions and 6 deletions

View File

@ -35,21 +35,20 @@ axios.interceptors.response.use(
} }
} }
} }
if(res.config.headers['action'] == 53211) { // if(!res.request || res.request.responseType === 'blob') { //
return res; return res;
} }
const ret = res.data;
// token // token
if (ret.code === 3004) { if (res.data.code === 3004) {
localRemove("token"); localRemove("token");
ElMessage.closeAll(); ElMessage.closeAll();
ElMessage.error(ret.message || "Token异常,请重新登录"); ElMessage.error(res.data.message || "Token异常,请重新登录");
router.push({ router.push({
path: "/login" path: "/login"
}); });
return Promise.reject(ret); return Promise.reject(res.data);
} }
return ret; return Promise.resolve(res.data);
}, },
(error) => { (error) => {
ElMessage.closeAll(); ElMessage.closeAll();