main
小霞 2025-02-06 12:06:05 +08:00
parent ef24583228
commit 37561068a3
1 changed files with 3 additions and 2 deletions

View File

@ -1,5 +1,6 @@
import axios from "axios";
import { ElMessage } from 'element-plus'
import { useRouter } from "vue-router";
interface requestType {
url: string
@ -7,13 +8,13 @@ interface requestType {
}
const handleCode = async (code: number, msg: string) => {
console.log(code);
const router = useRouter();
switch (code) {
case 401:
ElMessage.error(msg || '登录失效')
setTimeout(() => {
console.log('登录失效')
location.href = "/login"
router.push("/login")
}, 1500)
// 跳转登录
break