From 453a5e363b22becaaed1ddd017b10f740f286e6a Mon Sep 17 00:00:00 2001 From: Lee sang Yeop Date: Tue, 12 Sep 2023 01:42:29 +0900 Subject: [PATCH 1/2] =?UTF-8?q?Test:=20=EA=B2=BD=EA=B8=B0=EC=97=90=20?= =?UTF-8?q?=EC=B0=B8=EA=B0=80=EC=9A=94=EC=B2=AD=ED=95=98=EB=8A=94=20MSW=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- __mocks__/handlers/channelHandlers.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/__mocks__/handlers/channelHandlers.ts b/__mocks__/handlers/channelHandlers.ts index 390e002..98462d0 100644 --- a/__mocks__/handlers/channelHandlers.ts +++ b/__mocks__/handlers/channelHandlers.ts @@ -71,6 +71,9 @@ const channelHandlers = [ rest.post(SERVER_URL + '/api/channel/:channelLink', (req, res, ctx) => { return res(ctx.status(200), ctx.json({})); }), + rest.post(SERVER_URL + '/api/:channelLink/participant', (req, res, ctx) => { + return res(ctx.status(200), ctx.json({})); + }), ]; export default channelHandlers; From f300f630e31758ecb69aed3e62842280c783136d Mon Sep 17 00:00:00 2001 From: Lee sang Yeop Date: Tue, 12 Sep 2023 01:43:15 +0900 Subject: [PATCH 2/2] =?UTF-8?q?Feat:=20=EA=B2=BD=EA=B8=B0=EC=97=90=20?= =?UTF-8?q?=EC=A0=95=EC=83=81=EC=A0=81=EC=9C=BC=EB=A1=9C=20=EC=B0=B8?= =?UTF-8?q?=EC=97=AC=ED=95=A0=20=EC=88=98=20=EC=9E=88=EB=8F=84=EB=A1=9D=20?= =?UTF-8?q?=EC=84=9C=EB=B2=84=20=ED=86=B5=EC=8B=A0=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Modal/JoinLeague/JoinLeague.tsx | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/components/Modal/JoinLeague/JoinLeague.tsx b/src/components/Modal/JoinLeague/JoinLeague.tsx index c8ac685..32f0352 100644 --- a/src/components/Modal/JoinLeague/JoinLeague.tsx +++ b/src/components/Modal/JoinLeague/JoinLeague.tsx @@ -1,3 +1,4 @@ +import authAPI from '@apis/authAPI'; import Icon from '@components/Icon'; import { SERVER_URL } from '@config/index'; import { css } from '@emotion/react'; @@ -46,6 +47,21 @@ const JoinLeague = ({ onClose, channelLink }: JoinLeagueProps) => { return true; }; + const onClickSubmit: MouseEventHandler = async () => { + if (!nickname || !checked) return; + const res = await authAPI({ + method: 'post', + url: `/api/${channelLink}/participant`, + data: { + gameId, + nickname, + }, + }); + if (res.status !== 200) return; + alert('정상적으로 리그참여 요청을 전송했어요'); + onClose(); + }; + useEffect(() => { if (profile) setNickname(profile.nickname); }, []); @@ -124,7 +140,9 @@ const JoinLeague = ({ onClose, channelLink }: JoinLeagueProps) => { 취소 - 신청 + + 신청 + );