|
|
|
@ -37,11 +37,15 @@ instance.interceptors.request.use(
|
|
|
|
|
// 基础请求参数
|
|
|
|
|
const tokenInfo = vm.getSession('CX_Common_UserInfo'),
|
|
|
|
|
base = {},
|
|
|
|
|
postData = {...base, ...config.data };
|
|
|
|
|
tokenInfo.access_token && (config.headers[`Authorization`] = `Bearer:${tokenInfo.access_token}`);
|
|
|
|
|
postData = { ...base,
|
|
|
|
|
...config.data
|
|
|
|
|
};
|
|
|
|
|
tokenInfo.access_token && (config.headers[`Authorization`] = `Bearer${tokenInfo.platform === 'front' ? ' ' : ':'}${tokenInfo.access_token}`);
|
|
|
|
|
config.method === 'post' ?
|
|
|
|
|
config.data = config.headers['Content-Type'] == 'application/x-www-form-urlencoded' ? qs.stringify(postData) : JSON.stringify(postData) :
|
|
|
|
|
config.params = {...base, ...config.params };
|
|
|
|
|
config.params = { ...base,
|
|
|
|
|
...config.params
|
|
|
|
|
};
|
|
|
|
|
return config;
|
|
|
|
|
},
|
|
|
|
|
error => Promise.error(error))
|
|
|
|
@ -119,7 +123,9 @@ instance.interceptors.response.use(
|
|
|
|
|
// vm.$message.error(other)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
const { response } = error;
|
|
|
|
|
const {
|
|
|
|
|
response
|
|
|
|
|
} = error;
|
|
|
|
|
if (response.status == 500 && apiOne == 1) {
|
|
|
|
|
let id = JSON.parse(sessionStorage.getItem('CX_CoopUserInfo')).id
|
|
|
|
|
instance.get(`/auth/token/checkTokenIsExesists?clientId=${id}`).then(res => {
|
|
|
|
|