Ver Fonte

🐛 fix(profile): 修复用户关注状态和数量获取的参数传递问题

- 为关注状态查询添加缺失的param参数
- 为关注者数量查询添加缺失的param参数
- 为关注数量查询添加缺失的param参数
- 统一API调用参数格式,确保用户ID正确传递
yourname há 5 meses atrás
pai
commit
c5a389d17b
1 ficheiros alterados com 10 adições e 3 exclusões
  1. 10 3
      src/client/home/pages/UserProfilePage.tsx

+ 10 - 3
src/client/home/pages/UserProfilePage.tsx

@@ -43,16 +43,23 @@ const UserProfilePage: React.FC = () => {
       if (currentUser && currentUser.id !== Number(id)) {
         rpcLogger('Checking follow status from user %s to user %s', currentUser.id, id);
         const followStatus = await userClient[':id'].following['$get']({
-          param: { id: id }
+          param: { id },
+          query: { page: 1}
         });
         setIsFollowing(followStatus.ok);
       }
       
       // 获取关注数量
       rpcLogger('Fetching followers count for user: %s', id);
-      const followers = await userClient[':id'].followers['$get']({ query: { pageSize: 1 } });
+      const followers = await userClient[':id'].followers['$get']({ 
+        param: { id },
+        query: { pageSize: 1 } 
+      });
       rpcLogger('Fetching following count for user: %s', id);
-      const following = await userClient[':id'].following['$get']({ query: { pageSize: 1 } });
+      const following = await userClient[':id'].following['$get']({ 
+        param: { id },
+        query: { pageSize: 1 } 
+      });
       
       setFollowerCount(await followers.json().then(data => data.pagination.total));
       setFollowingCount(await following.json().then(data => data.pagination.total));