Parcourir la source

fix: 增加第三方登录-重定向地址获取方式

xieyonghong il y a 3 ans
Parent
commit
0f00126fe4
1 fichiers modifiés avec 6 ajouts et 4 suppressions
  1. 6 4
      src/pages/account/Center/bind/index.tsx

+ 6 - 4
src/pages/account/Center/bind/index.tsx

@@ -39,10 +39,12 @@ const Bind = () => {
     });
   };
   const goRedirect = () => {
-    const url = window.location.href.split('redirect=')?.[1];
-    console.log(url);
-    if (url) {
-      window.location.href = url;
+    const urlParams = new URLSearchParams(window.location.hash);
+    const redirectUrl = urlParams.get('redirect');
+    // const url = window.location.href.split('redirect=')?.[1];
+    console.log(redirectUrl);
+    if (redirectUrl) {
+      window.location.href = redirectUrl;
     }
   };