Browse Source

Merge pull request #639 from jetlinks/next-wzy

fix: oauth
hear 3 năm trước cách đây
mục cha
commit
acb9c49f0f
2 tập tin đã thay đổi với 15 bổ sung8 xóa
  1. 4 4
      config/proxy.ts
  2. 11 4
      src/pages/account/Center/bind/index.tsx

+ 4 - 4
config/proxy.ts

@@ -15,13 +15,13 @@ export default {
       // target: 'http://120.79.18.123:8844/',
       // ws: 'ws://120.79.18.123:8844/',
       // 测试环境
-      // target: 'http://120.77.179.54:8844/',
-      // ws: 'ws://120.77.179.54:8844/',
+      target: 'http://120.77.179.54:8844/',
+      ws: 'ws://120.77.179.54:8844/',
       // target: 'http://192.168.32.65:8844/',
       // ws: 'ws://192.168.32.65:8844/',
       //v2环境
-      ws: 'ws://47.109.52.230:8844',
-      target: 'http://47.109.52.230:8844',
+      // ws: 'ws://47.109.52.230:8844',
+      // target: 'http://47.109.52.230:8844',
       changeOrigin: true,
       pathRewrite: { '^/api': '' },
     },

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

@@ -148,11 +148,12 @@ const Bind = () => {
     // const params = '5c021c8892d4afffd8fd42439c4e2382'
     setCode(params);
     bindUserInfo(params);
-    if (localStorage.getItem('onLogin') === 'yes' || isLogin === 'yes') {
-      getDetail();
-    }
+    // getDetail();
     if (localStorage.getItem('onLogin')) {
       setIslogin(localStorage.getItem('onLogin'));
+      if (localStorage.getItem('onLogin') === 'yes' || isLogin === 'yes') {
+        getDetail();
+      }
     }
     service.settingDetail('front').then((res) => {
       if (res.status === 200) {
@@ -165,7 +166,13 @@ const Bind = () => {
         }
       }
     });
-  }, []);
+  }, [window.location.href]);
+
+  useEffect(() => {
+    if (isLogin === 'yes') {
+      getDetail();
+    }
+  }, [isLogin]);
   useEffect(getCode, []);
 
   return (