Просмотр исходного кода

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

xieyonghong 3 лет назад
Родитель
Сommit
fe58aad14d
1 измененных файлов с 2 добавлено и 1 удалено
  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 = () => {
+    if (!localStorage.getItem('X-Access-Token')) return;
     service.getUserDetail().subscribe((res) => {
       setUser(res?.result);
     });
@@ -178,7 +179,7 @@ const Bind = () => {
   }, [window.location.href]);
 
   useEffect(() => {
-    if (isLogin === 'yes' && localStorage.getItem('X-Access-Token')) {
+    if (isLogin === 'yes') {
       getDetail();
     }
   }, [isLogin]);