Add redirect to sub official for wechat (#132)

Co-authored-by: AceDataCloud <office@acedata.cloud>
This commit is contained in:
GermeyandAceDataCloud authored and GitHub committed 2024-08-31 01:04:02 +08:00
1 parent e453968abe
commit 0874e193d8
8 files changed
+62 -6

No files matched your search

+23
View File
@@ -2,6 +2,8 @@
* Js JSON string
*/
import { BASE_HOST_HUB } from '@/constants';
export const isJSONString = (str: string): boolean => {
try {
JSON.parse(str);
@@ -10,3 +12,24 @@ export const isJSONString = (str: string): boolean => {
}
return true;
};
/**
* Check if the string is wechat browser
*/
export const isWechatBrowser = (): boolean => {
return /micromessenger/i.test(navigator.userAgent);
};
/**
* isOfficial
*/
export const isOfficial = (): boolean => {
return window.location.host.includes(BASE_HOST_HUB);
};
/**
* isSubOfficial
*/
export const isSubOfficial = (): boolean => {
return isOfficial() && window.location.host !== BASE_HOST_HUB;
};