Add redirect to sub official for wechat (#132)
Co-authored-by: AceDataCloud <office@acedata.cloud>
This commit is contained in:
1 parent
e453968abe
commit
0874e193d8
8 files changed
+62
-6
No files matched your search
@@ -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;
|
||||
};
|
||||
Reference in new issue
Block a user