diff options
| author | Ivan Chen <ivan@tagg.id> | 2021-05-11 18:42:53 -0400 |
|---|---|---|
| committer | Ivan Chen <ivan@tagg.id> | 2021-05-11 18:42:53 -0400 |
| commit | 51f397132d227edf5e07d48d673ee167d2aa5937 (patch) | |
| tree | e3813ec91919bc30a551194ab2585ac988b41589 /src/services | |
| parent | fab3b1f7d046895dbaaff1ceddbc75f9ffc7fda0 (diff) | |
made things faster
Diffstat (limited to 'src/services')
| -rw-r--r-- | src/services/CommentService.ts | 3 |
1 files changed, 2 insertions, 1 deletions
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, { |
