23 lines
532 B
TypeScript
23 lines
532 B
TypeScript
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;
|