From f93c47ee36dd971b0cc621b224ff0bafd11e44fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=A0=84=EC=A7=84=ED=98=B8?= Date: Thu, 8 Feb 2024 21:27:04 +0900 Subject: [PATCH 1/5] fix: change topics api url --- src/apis/topic/useTopics.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/apis/topic/useTopics.ts b/src/apis/topic/useTopics.ts index 6de0df0..5bd8a82 100644 --- a/src/apis/topic/useTopics.ts +++ b/src/apis/topic/useTopics.ts @@ -14,7 +14,7 @@ import client from '@apis/fetch'; export const TOPIC_KEY = 'topics'; const getTopics = () => { - return client.get>('/topics/info/voting?size=100'); + return client.get>('/topics/info?size=100'); }; const useTopics = () => { From a8912b7a46e199689fce0b0060336cbf7d0d81ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=A0=84=EC=A7=84=ED=98=B8?= Date: Thu, 8 Feb 2024 22:38:36 +0900 Subject: [PATCH 2/5] fix: make TopicResponse's field nullable --- src/interfaces/api/topic.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/interfaces/api/topic.ts b/src/interfaces/api/topic.ts index 78e517d..fc7fd60 100644 --- a/src/interfaces/api/topic.ts +++ b/src/interfaces/api/topic.ts @@ -7,10 +7,10 @@ interface TopicResponse { topicId: number; topicSide: string; topicTitle: string; - deadline: number; // 1702914494 + deadline: number | null; // 1702914494 voteCount: number; - topicContent: string; // TBD - keyword: Keyword; + topicContent: string | null; + keyword: Keyword | null; choices: Choice[]; author: Author; selectedOption: typeof CHOICE_OPTIONS.CHOICE_A | typeof CHOICE_OPTIONS.CHOICE_B | null; From 09eb2801fc5013ac12011f15075b1d6e902ca0ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=A0=84=EC=A7=84=ED=98=B8?= Date: Thu, 8 Feb 2024 22:49:17 +0900 Subject: [PATCH 3/5] fix: optionally render nullable content --- src/components/Home/CommentBox/CommentBox.tsx | 24 ++++++++++++------- src/components/Home/TopicCard/TopicCard.tsx | 6 ++--- 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/src/components/Home/CommentBox/CommentBox.tsx b/src/components/Home/CommentBox/CommentBox.tsx index c3e1d81..e13625a 100644 --- a/src/components/Home/CommentBox/CommentBox.tsx +++ b/src/components/Home/CommentBox/CommentBox.tsx @@ -6,6 +6,7 @@ import Text from '@components/commons/Text/Text'; import { UserProfileImage } from '@components/Home/TopicCard/TopicCard.styles'; import useModal from '@hooks/useModal/useModal'; import { LatestComment } from '@interfaces/api/comment'; +import { TopicResponse } from '@interfaces/api/topic'; import { colors } from '@styles/theme'; @@ -27,8 +28,8 @@ interface CommentBoxProps { onClick: () => void; topicId: number; hasVoted: boolean; - side: 'A' | 'B'; - keyword: string; + side: TopicResponse['topicSide']; + keyword: TopicResponse['keyword']; commentCount: number; voteCount: number; latestComment: LatestComment | undefined; @@ -65,14 +66,19 @@ const CommentBox = ({ - {side} 사이드 - - - | - - - {keyword} + {side === 'TOPIC_A' ? 'A' : 'B'} 사이드 + {keyword && ( + <> + {' '} + + | + + + {keyword.keywordName} + + + )}