Browse Source

🐛 fix(home): 修复帖子点赞功能调用错误

- 修正postClient调用方式,使用param参数传递postId
- 解决点赞接口无法正确识别帖子ID的问题
yourname 5 months ago
parent
commit
8582e71da1
1 changed files with 3 additions and 1 deletions
  1. 3 1
      src/client/home/pages/HomePage.tsx

+ 3 - 1
src/client/home/pages/HomePage.tsx

@@ -62,7 +62,9 @@ const HomePage: React.FC = () => {
   // 点赞帖子
   const handleLike = async (postId: number) => {
     try {
-      await postClient[postId].like.$post();
+      await postClient[':id'].like.$post({
+        param: { id: postId }
+      });
       setPosts(posts.map(post => 
         post.id === postId ? { ...post, likesCount: post.likesCount + 1 } : post
       ));