feat: 登录失效之后再次跳转到登录的页面
This commit is contained in:
@@ -2,6 +2,7 @@ import { getCurrentConfig } from "@/constant/base";
|
|||||||
import { useAppStore } from "@/store";
|
import { useAppStore } from "@/store";
|
||||||
import { NOTICE_EVENT_LOGOUT } from "@/constant/constant";
|
import { NOTICE_EVENT_LOGOUT } from "@/constant/constant";
|
||||||
import { getAccessToken } from "@/constant/token";
|
import { getAccessToken } from "@/constant/token";
|
||||||
|
import { goLogin } from "../../hooks/useGoLogin";
|
||||||
|
|
||||||
const clientId = getCurrentConfig().clientId;
|
const clientId = getCurrentConfig().clientId;
|
||||||
const defaultConfig = {
|
const defaultConfig = {
|
||||||
@@ -60,6 +61,10 @@ function request(url, args = {}, method = "POST", customConfig = {}) {
|
|||||||
console.log("424错误,重新登录");
|
console.log("424错误,重新登录");
|
||||||
removeAccessToken();
|
removeAccessToken();
|
||||||
uni.$emit(NOTICE_EVENT_LOGOUT);
|
uni.$emit(NOTICE_EVENT_LOGOUT);
|
||||||
|
setTimeout(() => {
|
||||||
|
/// 去登录页面
|
||||||
|
goLogin();
|
||||||
|
}, 500);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
fail: (err) => {
|
fail: (err) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user