fix: update login error
This commit is contained in:
@@ -34,20 +34,13 @@ query.beforeRequest = async (config) => {
|
||||
};
|
||||
query.afterResponse = async (response, ctx) => {
|
||||
if (response.code === 401) {
|
||||
if (query.stop) {
|
||||
return {
|
||||
code: 500,
|
||||
message: '登录已过期',
|
||||
};
|
||||
}
|
||||
query.stop = true;
|
||||
const res = await queryLogin.afterCheck401ToRefreshToken(response, ctx);
|
||||
query.stop = false;
|
||||
return res;
|
||||
console.log('401 after', response);
|
||||
}
|
||||
return response as any;
|
||||
};
|
||||
export const queryLogin = new QueryLoginNode({
|
||||
query: query as any,
|
||||
onLoad: async () => {},
|
||||
onLoad: async () => {
|
||||
// console.log('onLoad');
|
||||
},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user