登录超时重定向问题
This commit is contained in:
parent
4d7240ea96
commit
c8b8f26051
@ -38,6 +38,7 @@ axios.interceptors.request.use(config => {
|
||||
config.data = { unused: 0 } // 这个是关键点,解决get 请求添加不上content_type
|
||||
}
|
||||
config.headers['X-USER-ID'] = DevUserId;
|
||||
config.headers['X-SOURCE'] = 'page';
|
||||
return config
|
||||
});
|
||||
|
||||
@ -82,6 +83,10 @@ export function get<T>(req: Req<T>) {
|
||||
req.onSuccess(res);
|
||||
}).catch(error => {
|
||||
if (error.response) {
|
||||
if(error.response.status === 401) {
|
||||
window.location.href = axios.defaults.baseURL ? axios.defaults.baseURL : '';
|
||||
return;
|
||||
}
|
||||
const data = error.response.data;
|
||||
req.messageApi.open({
|
||||
type: 'error',
|
||||
|
Loading…
Reference in New Issue
Block a user