瀏覽代碼

added in actionFidSubComment get likes owner _id

makstravm 2 年之前
父節點
當前提交
743e9eb279
共有 2 個文件被更改,包括 3 次插入2 次删除
  1. 1 1
      src/actions/index.js
  2. 2 1
      src/components/main/post/PostComment.js

+ 1 - 1
src/actions/index.js

@@ -340,7 +340,7 @@ export const actionFindSubComment = (findId) =>
                 post {_id }
                 answers { _id}
                 createdAt
-                likes { _id owner { login nick } }
+                likes { _id owner { _id login nick } }
                 owner {
                     _id login nick 
                     avatar { url } 

+ 2 - 1
src/components/main/post/PostComment.js

@@ -58,8 +58,9 @@ export const PostCommentDate = ({ createdAt }) =>
 
 const PostCommentAction = ({ myID, commentId, likes, delLikeComment, addLikeComment }) => {
     const [open, setOpen] = useState(false);
+    debugger
     const likeId = likes.find(l => l?.owner?._id === myID)?._id
-
+    console.log(likeId)
     const changeLike = () => likeId ? delLikeComment(likeId, commentId) : addLikeComment(commentId)
 
     return (