mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2025-12-25 01:30:07 +08:00
fix: remove useless defineProps fix: add the missing dependencies to package.json fix: add ES2022 into tsconfig.json
15 lines
482 B
TypeScript
15 lines
482 B
TypeScript
import { MessagePlugin } from 'tdesign-vue-next';
|
|
import { router } from '@/router/index.js';
|
|
|
|
export const request = async (input: RequestInfo | URL, init?: RequestInit) => {
|
|
const res = await fetch(input, init);
|
|
const json = await res.json();
|
|
if (json.msg.includes('Unauthorized')) {
|
|
MessagePlugin.error('Token 过期啦, 重新登录吧');
|
|
localStorage.clear();
|
|
router.push('/webui');
|
|
}
|
|
res.json = async () => json;
|
|
return res;
|
|
};
|