From 51f397132d227edf5e07d48d673ee167d2aa5937 Mon Sep 17 00:00:00 2001 From: Ivan Chen Date: Tue, 11 May 2021 18:42:53 -0400 Subject: made things faster --- src/services/CommentService.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/services') diff --git a/src/services/CommentService.ts b/src/services/CommentService.ts index ad8f14ac..6d71ce9c 100644 --- a/src/services/CommentService.ts +++ b/src/services/CommentService.ts @@ -136,6 +136,7 @@ export const deleteComment = async (id: string, isThread: boolean) => { */ export const handleLikeUnlikeComment = async ( comment: CommentType | CommentThreadType, + liked: boolean, ) => { try { const isReply = 'parent_comment' in comment; @@ -143,7 +144,7 @@ export const handleLikeUnlikeComment = async ( let url = isReply ? COMMENT_REACTIONS_REPLY_ENDPOINT : COMMENT_REACTIONS_ENDPOINT; - if (comment.user_reaction !== null) { + if (liked) { // unlike a comment url += `${comment.comment_id}/?reaction_type=LIKE`; const response = await fetch(url, { -- cgit v1.2.3-70-g09d2