Fix redirection issue (#265)

This commit is contained in:
Germey authored and GitHub committed 2025-08-24 08:51:59 +08:00
1 parent 67b47dd42f
commit 951eeb80d5
3 files changed
+15 -2

No files matched your search

@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "fix redirect issue",
"packageName": "@acedatacloud/nexior",
"email": "cqc@cuiqingcai.com",
"dependentChangeType": "patch"
}
+5 -1
View File
@@ -28,7 +28,11 @@ import {
const main = async () => {
// async and need to await
await initializeRedirect();
const isRedirected = await initializeRedirect();
if (isRedirected) {
// if redirected, stop initialization
return;
}
await initializeCookies();
await initializeToken();
await initializeUser();
+3 -1
View File
@@ -214,7 +214,7 @@ export const initializeExchangeRate = async () => {
await store.dispatch('getExchangeRate', payload);
};
export const initializeRedirect = async () => {
export const initializeRedirect = async (): Promise<boolean> => {
if (isOfficial() && !isSubOfficial() && isWechatBrowser()) {
console.debug('redirect to sub domain with prefix');
// redirect from hub.acedata.cloud to dynamic date like 20240802.hub.acedata.cloud
@@ -222,7 +222,9 @@ export const initializeRedirect = async () => {
const newUrl = window.location.href.replace(BASE_HOST_HUB, `${date}.${BASE_HOST_HUB}`);
console.debug('redirect to', newUrl);
window.location.href = newUrl;
return true;
}
return false;
};
export const initializeFingerprint = async () => {