Commit 1a76d87f by yancanhua

Merge branch 'release/venus-usedcar-h5/1.0.0' of http://192.168.3.233:8090/monor…

…epo/venus into release/venus-usedcar-h5/1.0.0
2 parents a2040177 c621e773
Pipeline #166 for 1a76d87f failed in 0 seconds
......@@ -84,6 +84,24 @@ function buildLoginUrlWithHostContext(): string {
return `${next.pathname}${next.search}`;
}
function getLoginRouteQueryFromCurrentUrl(): { openType?: string } {
const url = new URL(window.location.href);
const openType = url.searchParams.get("openType");
return openType ? { openType } : {};
}
async function navigateToLogin() {
try {
const { default: router } = await import("@/router");
await router.replace({
path: "/login",
query: getLoginRouteQueryFromCurrentUrl(),
});
} catch {
window.location.replace(buildLoginUrlWithHostContext());
}
}
function redirectToLogin(message?: string) {
if (isRedirectingToLogin) {
return;
......@@ -91,7 +109,7 @@ function redirectToLogin(message?: string) {
isRedirectingToLogin = true;
showToast(message || "登录已过期,请重新登录");
localStorage.removeItem(TOKEN_KEY);
window.location.replace(buildLoginUrlWithHostContext());
void navigateToLogin();
}
let axiosInstance: AxiosInstance | null = null;
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!