|
@@ -3,7 +3,7 @@ import {Base64} from 'js-base64';
|
|
|
import website from '~src/config';
|
|
|
import router from '~src/router/index';
|
|
|
import {getToken} from '~src/api/util/auth';
|
|
|
-import {toSerialize} from "js-fast-way"
|
|
|
+import {getObjValue, toSerialize} from "js-fast-way"
|
|
|
|
|
|
//默认超时时间
|
|
|
axios.defaults.timeout = 0;
|
|
@@ -43,11 +43,10 @@ axios.interceptors.response.use(res => {
|
|
|
//响应时间
|
|
|
res.config.metadata.endTime = new Date()
|
|
|
//获取状态码
|
|
|
- const status = res.data?.code || res.status;
|
|
|
- const message = res.data?.msg || res.data['error_description'] || '未知错误';
|
|
|
+ const status = res?.data?.code || res.status;
|
|
|
//如果是401则跳转到登录页面
|
|
|
if (status === 401) {
|
|
|
- window.$message?.error(message || '身份失效!');
|
|
|
+ window.$message?.error('身份失效,请重新登录!');
|
|
|
router.push({path: '/login'})
|
|
|
}
|
|
|
// 如果请求为非200, 自行catch逻辑处理
|