Parcourir la source

fix: 增加第三方登录-无token显示错误问题

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

+ 2 - 1
src/pages/account/Center/bind/index.tsx

@@ -47,6 +47,7 @@ const Bind = () => {
   };
   };
 
 
   const getDetail = () => {
   const getDetail = () => {
+    if (!localStorage.getItem('X-Access-Token')) return;
     service.getUserDetail().subscribe((res) => {
     service.getUserDetail().subscribe((res) => {
       setUser(res?.result);
       setUser(res?.result);
     });
     });
@@ -178,7 +179,7 @@ const Bind = () => {
   }, [window.location.href]);
   }, [window.location.href]);
 
 
   useEffect(() => {
   useEffect(() => {
-    if (isLogin === 'yes' && localStorage.getItem('X-Access-Token')) {
+    if (isLogin === 'yes') {
       getDetail();
       getDetail();
     }
     }
   }, [isLogin]);
   }, [isLogin]);