From 2958f154d2fa46dc1373c9560aa8427703953e10 Mon Sep 17 00:00:00 2001 From: js43o Date: Thu, 23 Nov 2023 22:17:41 +0900 Subject: [PATCH] =?UTF-8?q?=F0=9F=A4=A1=20=EB=AA=A8=EA=B0=81=EC=BD=94=20?= =?UTF-8?q?=EC=B0=B8=EC=84=9D/=EC=B0=B8=EC=84=9D=20=EC=B7=A8=EC=86=8C=20mo?= =?UTF-8?q?ck=20API=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/frontend/src/mocks/mogaco.ts | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/app/frontend/src/mocks/mogaco.ts b/app/frontend/src/mocks/mogaco.ts index b1846c35f..8803ac0aa 100644 --- a/app/frontend/src/mocks/mogaco.ts +++ b/app/frontend/src/mocks/mogaco.ts @@ -67,6 +67,23 @@ export const mogacoAPIHandlers = [ http.get('/mogaco/:id/participants', ({ params: { id } }) => HttpResponse.json(participantsList[Number(id) - 1]), ), - http.post('mogaco/:id/join', () => {}), - http.delete('mogaco/:id/join', () => {}), + http.post<{ id: string }, { memberId: string }>( + 'mogaco/:id/join', + async ({ request, params: { id } }) => { + const { memberId } = await request.json(); + participantsList[Number(id) - 1] = [ + ...participantsList[Number(id) - 1], + userList[Number(memberId) - 1], + ]; + }, + ), + http.delete<{ id: string }, { memberId: string }>( + 'mogaco/:id/join', + async ({ request, params: { id } }) => { + const { memberId } = await request.json(); + participantsList[Number(id) - 1] = participantsList[ + Number(id) - 1 + ].filter((participant) => participant.id !== memberId); + }, + ), ];