From 5df76c57c213a92a1dd171751d431503962db14d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=B2=9C=EC=A7=80=EC=9C=A4?= <70828192+cheonjiyun@users.noreply.github.com> Date: Sun, 15 Dec 2024 22:36:03 +0900 Subject: [PATCH 1/4] =?UTF-8?q?chore:=20=EA=B8=80=EC=94=A8=20=EC=A0=9C?= =?UTF-8?q?=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/Night.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/pages/Night.tsx b/src/pages/Night.tsx index 7aa2c68..e033b59 100644 --- a/src/pages/Night.tsx +++ b/src/pages/Night.tsx @@ -39,7 +39,6 @@ export default function Night({ statusType, publishSkill, mafiaSkillPlayer }: Pr ) : (
{chats[0].name}
{chats.map((chat, idx) => ( diff --git a/src/util/job.ts b/src/util/job.ts new file mode 100644 index 0000000..4d24d35 --- /dev/null +++ b/src/util/job.ts @@ -0,0 +1,5 @@ +import { Job, Player } from '../type'; + +export const getPlayerJob = (players: Player[], name: string): Job => { + return players.find(el => el.name == name)?.job || null; +}; From 7ddd936bb9eb7a35a6303bcd2f72224943a5e879 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=B2=9C=EC=A7=80=EC=9C=A4?= <70828192+cheonjiyun@users.noreply.github.com> Date: Thu, 26 Dec 2024 15:22:50 +0900 Subject: [PATCH 3/4] =?UTF-8?q?refactor:=20SSE=EC=99=80=20=EC=9B=B9?= =?UTF-8?q?=EC=86=8C=EC=BC=93=20URL=EC=9D=84=20=ED=95=9C=20=ED=8C=8C?= =?UTF-8?q?=EC=9D=BC=EC=97=90=EC=84=9C=20=EA=B4=80=EB=A6=AC=ED=95=9C?= =?UTF-8?q?=EB=8B=A4.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/Game.tsx | 26 +++++++++++++++----------- src/socket/url.ts | 10 ++++++++++ src/sse/url.ts | 3 +++ 3 files changed, 28 insertions(+), 11 deletions(-) create mode 100644 src/socket/url.ts create mode 100644 src/sse/url.ts diff --git a/src/pages/Game.tsx b/src/pages/Game.tsx index 113e6b2..fd02911 100644 --- a/src/pages/Game.tsx +++ b/src/pages/Game.tsx @@ -4,8 +4,9 @@ import { useEffect, useRef, useState } from 'react'; import { useRecoilState, useSetRecoilState } from 'recoil'; import { getChats, getGamesInfo, getMyJob } from '../axios/http'; -import { BASE_URL, DOMAIN } from '../axios/instances'; import { gameRound, myJobState, roomInfoState } from '../recoil/roominfo/atom'; +import { BORKER_URL, CHAT_PUB, CHAT_SUB, JOB_SKILL_SUB } from '../socket/url'; +import { EVENTSOURCE_URL } from '../sse/url'; import { ChatArray, ChatResponse, GameStatus, SkillResponse, WaitingRoomInfo } from '../type'; import Day from './Day'; import Night from './Night'; @@ -20,7 +21,6 @@ export default function Game() { const [chatSubscribeId, setChatSubscribeId] = useState