fix: Login Check

This commit is contained in:
手瓜一十雪
2024-12-13 17:38:27 +08:00
parent ab4fbb4cf6
commit 7e562148b8
5 changed files with 41 additions and 46 deletions

View File

@@ -1,14 +0,0 @@
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.message.includes('Unauthorized')) {
MessagePlugin.error('Token 过期啦, 重新登录吧');
localStorage.clear();
router.push('/webui');
}
res.json = async () => json;
return res;
};