diff options
-rw-r--r-- | src/components/comments/CommentTile.tsx | 2 | ||||
-rw-r--r-- | src/services/CommentService.ts | 2 | ||||
-rw-r--r-- | src/types/types.ts | 2 |
3 files changed, 3 insertions, 3 deletions
diff --git a/src/components/comments/CommentTile.tsx b/src/components/comments/CommentTile.tsx index e3364007..a31c5b51 100644 --- a/src/components/comments/CommentTile.tsx +++ b/src/components/comments/CommentTile.tsx @@ -150,7 +150,7 @@ const CommentTile: React.FC<CommentTileProps> = ({ screenType={screenType} /> <LikeButton - filled={commentObject.user_reaction !== undefined} + filled={commentObject.user_reaction !== null} onPress={() => handleLikeUnlikeComment(commentObject)} style={styles.likeButton} /> diff --git a/src/services/CommentService.ts b/src/services/CommentService.ts index 910f4fa6..f5583ac0 100644 --- a/src/services/CommentService.ts +++ b/src/services/CommentService.ts @@ -136,7 +136,7 @@ export const deleteComment = async (id: string, isThread: boolean) => { export const handleLikeUnlikeComment = async (comment: CommentBaseType) => { try { const token = await AsyncStorage.getItem('token'); - if (comment.user_reaction !== undefined) { + if (comment.user_reaction !== null) { // unlike a comment const url = COMMENT_REACTIONS_ENDPOINT + `${comment.user_reaction.id}/`; const response = await fetch(url, { diff --git a/src/types/types.ts b/src/types/types.ts index e922d307..e9975529 100644 --- a/src/types/types.ts +++ b/src/types/types.ts @@ -122,7 +122,7 @@ export interface CommentBaseType { comment: string; date_created: string; commenter: ProfilePreviewType; - user_reaction: ReactionType | undefined; + user_reaction: ReactionType | null; reaction_count: number; } |