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