diff options
author | Ivan Chen <ivan@tagg.id> | 2021-05-10 16:42:09 -0400 |
---|---|---|
committer | Ivan Chen <ivan@tagg.id> | 2021-05-10 16:50:42 -0400 |
commit | 0e9ec9b6403c1556fc53e895eb16ca477106e48e (patch) | |
tree | 610e9b5cb4a52c7bce2dc91fefc3e154b73eed8e /src | |
parent | c3f7b66e4941d3bc0a0406e46f3b8fce5e01329e (diff) |
fixed undefined -> null
Diffstat (limited to 'src')
-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; } |