Bookmarks and fast reactions

This commit is contained in:
aeroreyna
2022-03-08 21:16:38 -08:00
parent 2be81cc9d3
commit 9d464e45bc
2 changed files with 31 additions and 15 deletions

View File

@@ -11,10 +11,9 @@ let Comment = ({ comment, postid, viewer }) => {
let [likes, changeLikes] = useState(Object.keys(comment.reactions).length);
const newCommentReaction = () => {
if (!comment.reactions[viewer._id]) {
API.newCommentReaction(postid, comment.createdAt).then(() => {
comment.reactions[viewer._id] = { type: "like" };
changeLikes(likes+1);
});
comment.reactions[viewer._id] = { type: "like" };
changeLikes(likes+1);
API.newCommentReaction(postid, comment.createdAt);
} else {
//API.removePostReaction(viewer._id).then(() => {
// delete comment.reactions[viewer._id];