From 0e9ec9b6403c1556fc53e895eb16ca477106e48e Mon Sep 17 00:00:00 2001 From: Ivan Chen Date: Mon, 10 May 2021 16:42:09 -0400 Subject: fixed undefined -> null --- src/components/comments/CommentTile.tsx | 2 +- src/services/CommentService.ts | 2 +- src/types/types.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src') 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 = ({ screenType={screenType} /> 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; } -- cgit v1.2.3-70-g09d2