This commit is contained in:
2026-01-30 17:03:32 +08:00
parent 06a12b5052
commit f9adaeca4d
44 changed files with 10227 additions and 0 deletions

28
src/modules/query.ts Normal file
View File

@@ -0,0 +1,28 @@
import { toast } from 'sonner';
import { QueryClient } from '@kevisual/query';
import { QueryLoginBrowser } from '@kevisual/api/login';
export const query = new QueryClient({});
console.log('初始化 query', query);
export const clientQuery = new QueryClient({});
export const queryLogin = new QueryLoginBrowser({
query: query as any,
});
query.beforeRequest = queryLogin.beforeRequest.bind(queryLogin);
query.afterResponse = async (res, ctx) => {
const newRes = await queryLogin.run401Action(res, ctx, {
afterAlso401: () => {
},
afterCheck: (res) => {
console.log('afterCheck', res);
if (res.code === 200) {
toast.success('刷新登陆信息');
setTimeout(() => {
window.location.reload();
}, 1000);
}
},
});
return newRes as any;
};