feat: add query-login

This commit is contained in:
2025-03-21 19:46:25 +08:00
parent cfd263a1e7
commit ca269e5ae2
24 changed files with 2548 additions and 822 deletions

View File

@@ -0,0 +1,22 @@
import { QueryLogin } from '../query-login';
import { Query } from '@kevisual/query';
const query = new Query({
url: 'https://kevisual.silkyai.cn/api/router',
});
query.before(async (options) => {
console.log('before', options);
const token = localStorage.getItem('token');
if (token) {
options.headers = {
...options.headers,
Authorization: `Bearer ${token}`,
};
}
return options;
});
const queryLogin = new QueryLogin({
query,
isBrowser: true,
});
// @ts-ignore
window.queryLogin = queryLogin;