fix: solve the token error

fix: remove useless defineProps
fix: add the missing dependencies to package.json
fix: add ES2022 into tsconfig.json
This commit is contained in:
huankong233
2024-12-10 09:44:38 +08:00
parent 1953995778
commit d8e7c2546d
12 changed files with 46 additions and 35 deletions

View File

@@ -0,0 +1,14 @@
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;
};