From ef2e1818e2b1f8cccb422665ee54b441ea92f6bf Mon Sep 17 00:00:00 2001 From: Lee sang Yeop Date: Sun, 8 Oct 2023 15:48:18 +0900 Subject: [PATCH] =?UTF-8?q?Fix:=20=EC=B1=84=ED=8C=85=20=EB=AC=B8=EC=A0=9C?= =?UTF-8?q?=20=ED=95=B4=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/RoundCheckIn/CallAdminChat.tsx | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/components/RoundCheckIn/CallAdminChat.tsx b/src/components/RoundCheckIn/CallAdminChat.tsx index 391c17e..5854285 100644 --- a/src/components/RoundCheckIn/CallAdminChat.tsx +++ b/src/components/RoundCheckIn/CallAdminChat.tsx @@ -57,14 +57,15 @@ const CallAdminChat = ({ setInputMessage(''); }; - const findUserIMG = (playerMatchId: number): string => { - const user = players.find((player) => player.matchPlayerId === playerMatchId); + const findUserIMG = (playerParticipantId: number): string => { + const user = players.find((player) => player.participantId === playerParticipantId); + if (!user) return ''; return user.profileSrc; }; - const findUserName = (playerMatchId: number): string => { - const user = players.find((player) => player.matchPlayerId === playerMatchId); + const findUserName = (playerParticipantId: number): string => { + const user = players.find((player) => player.participantId === playerParticipantId); if (!user) return ''; return user.gameId; }; @@ -72,7 +73,7 @@ const CallAdminChat = ({ useEffect(() => { if (!client) return; const subscription = client.subscribe(`/match/${matchId}/chat`, (data) => { - setChats([...chats, JSON.parse(data.body)]); + setChats((prevChat) => [...prevChat, JSON.parse(data.body)]); }); return () => { @@ -98,14 +99,14 @@ const CallAdminChat = ({ 프로필사진 - {findUserName(message.matchId)} + {findUserName(message.participantId)} {message.content} @@ -120,6 +121,7 @@ const CallAdminChat = ({