Skip to content

Commit 01dd226

Browse files
DaHyeonDaHyeon
authored andcommitted
Refactor : comment 닉네임 관련 수정
1 parent 30a2dfb commit 01dd226

1 file changed

Lines changed: 12 additions & 3 deletions

File tree

src/pages/EventMainPage.tsx

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -575,14 +575,23 @@ const convertedTeams: Team[] = groups.map((g: any) => ({
575575
: `opt${userVoteRaw}`
576576
: undefined;
577577

578-
const comments = (p.comments ?? []).map((c: any) => ({
578+
const comments = (p.comments ?? []).map((c: any) => {
579+
const fallbackAuthor =
580+
c.writerNickname ??
581+
eventInfo?.nickname ?? // 이벤트 참여 닉네임
582+
displayNickname ?? // 현재 로그인 유저 닉네임
583+
"익명";
584+
585+
return {
579586
id: String(c.commentId ?? c.id ?? ""),
580-
author: c.writerNickname ?? c.author ?? c.nickname ?? "익명",
587+
author: fallbackAuthor,
581588
content: c.content ?? c.text ?? "",
582589
timestamp: c.createdAt ?? c.createdAtAt ?? c.timestamp ?? "",
583590
imageUrl: c.imageUrl ?? c.img ?? undefined,
584591
isWrite: Boolean(c.isMine ?? c.isWrite ?? false),
585-
}));
592+
};
593+
});
594+
586595

587596
console.log(
588597
"[DEBUG][convertPost] full post object",

0 commit comments

Comments
 (0)