From fd28a7ce4b47efa147b9bf71b88c0102a3157417 Mon Sep 17 00:00:00 2001 From: JitHoon Date: Thu, 16 Nov 2023 18:24:50 +0900 Subject: [PATCH 1/2] =?UTF-8?q?Fix:=20=EC=B1=84=ED=8C=85=20=EB=93=A4?= =?UTF-8?q?=EC=96=B4=EA=B0=80=EA=B3=BC=20=EB=82=98=EA=B0=80=EA=B8=B0=20?= =?UTF-8?q?=EC=97=90=EB=9F=AC=20=ED=95=B4=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Components/Chat/ChatRoom.tsx | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/Components/Chat/ChatRoom.tsx b/Components/Chat/ChatRoom.tsx index 0075153..eef7302 100644 --- a/Components/Chat/ChatRoom.tsx +++ b/Components/Chat/ChatRoom.tsx @@ -8,6 +8,7 @@ import ChatHeader from '@/Components/Chat/ChatHeader'; import RenderChats from '@/Components/Chat/RenderChats'; import Image from 'next/image'; import Swal from 'sweetalert2'; +import { getCookie } from '../Login/Cookie'; const ChatRoom = ({ socket, @@ -24,6 +25,7 @@ const ChatRoom = ({ const [newMessage, setNewMessage] = useState(''); const [chatUsers, setChatUsers] = useState([]); const [chatName, setChatName] = useState(''); + const userId = getCookie('userId'); // 채팅 참여 유저 블러오기 useEffect(() => { @@ -85,7 +87,10 @@ const ChatRoom = ({ if (socket?.connected) { socket.on('join', (responseData) => { setChatUsers([...chatUsers, ...responseData.users]); - Swal.fire(`${responseData.users[0]} 님이 입장하셨습니다.`); + + if (responseData.users[0] !== userId) { + Swal.fire(`${responseData.leaver} 님이 퇴장하셨습니다.`); + } }); } @@ -100,7 +105,10 @@ const ChatRoom = ({ if (socket?.connected) { socket.on('leave', (responseData) => { setChatUsers([...chatUsers, ...responseData.users]); - Swal.fire(`${responseData.leaver} 님이 퇴장하셨습니다.`); + + if (responseData.leaver !== userId) { + Swal.fire(`${responseData.leaver} 님이 퇴장하셨습니다.`); + } }); } From d25a58b7bfef6796f5f7d05e8120921505bb2546 Mon Sep 17 00:00:00 2001 From: JitHoon Date: Thu, 16 Nov 2023 18:42:10 +0900 Subject: [PATCH 2/2] =?UTF-8?q?Fix:=20=EC=98=A4=ED=94=88=20=EC=B1=84?= =?UTF-8?q?=ED=8C=85=EB=B0=A9=20=EC=9D=B4=EB=AF=B8=EC=A7=80=20=EA=B9=A8?= =?UTF-8?q?=EC=A7=80=EB=8A=94=20=EB=AC=B8=EC=A0=9C=20=ED=95=B4=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Components/Search/OpenChatModal.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Components/Search/OpenChatModal.tsx b/Components/Search/OpenChatModal.tsx index 1a8ede8..926dc51 100644 --- a/Components/Search/OpenChatModal.tsx +++ b/Components/Search/OpenChatModal.tsx @@ -34,11 +34,13 @@ const OpenChatModal = ({ modalChat }: { modalChat: Chat }) => { user picture +