fix: 路由守卫

This commit is contained in:
纸凤孤凰
2024-12-10 16:59:57 +08:00
parent c11f1464e8
commit 5461d48644
4 changed files with 24 additions and 10 deletions

View File

@@ -1,10 +1,10 @@
import { MessagePlugin } from 'tdesign-vue-next';
import { router } from '@/router/index.js';
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')) {
if (json.message.includes('Unauthorized')) {
MessagePlugin.error('Token 过期啦, 重新登录吧');
localStorage.clear();
router.push('/webui');