Browse Source

字段判空

username 1 year ago
parent
commit
3f6b163410
1 changed files with 3 additions and 3 deletions
  1. 3 3
      src/app/[locale]/(ordinary)/profile/page.tsx

+ 3 - 3
src/app/[locale]/(ordinary)/profile/page.tsx

@@ -30,8 +30,8 @@ const Profile: FC<Props> = () => {
         getUserMoneyApi().then((res) => {
             res.code == 200 &&
                 setMoney({
-                    deposit: res.data.deposit,
-                    point: res.data.point,
+                    deposit: res.data?.deposit || 0.0,
+                    point: res.data?.point || 0.0
                 });
         });
     };
@@ -41,7 +41,7 @@ const Profile: FC<Props> = () => {
             userMoneyRequest();
         }
         // eslint-disable-next-line react-hooks/exhaustive-deps
-    }, []);
+    }, [token]);
 
     const router = useRouter();
     const goPage = (path = "/") => {