|
|
@ -16,15 +16,15 @@ export default function ({$axios, store, route}, inject) {
|
|
|
|
config.headers.Authorization = store.state.token;
|
|
|
|
config.headers.Authorization = store.state.token;
|
|
|
|
return config;
|
|
|
|
return config;
|
|
|
|
});
|
|
|
|
});
|
|
|
|
$axiosTk.onResponse(response => {
|
|
|
|
$axiosTk.onResponse(async response => {
|
|
|
|
const result = response.data;
|
|
|
|
const result = response.data;
|
|
|
|
if(response.status === 200){
|
|
|
|
if(response.status === 200){
|
|
|
|
if(result.code === 'SUCCESS'){
|
|
|
|
if(result.code === 'SUCCESS'){
|
|
|
|
return result.data;
|
|
|
|
return result.data;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(result.code === 'TOKEN_FAIL'){
|
|
|
|
if(result.code === 'TOKEN_FAIL'){
|
|
|
|
alert('这里要弹登录')
|
|
|
|
await store.dispatch('logout');
|
|
|
|
store.commit('setLoginOut');
|
|
|
|
store.commit('setLoginVisible');
|
|
|
|
return result;
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return Promise.reject(result);
|
|
|
|
return Promise.reject(result);
|
|
|
|