Skip to content

Commit

Permalink
๐Ÿคก ์ฐธ์„/์ฐธ์„ ์ทจ์†Œ mock API ์ˆ˜์ •
Browse files Browse the repository at this point in the history
  • Loading branch information
js43o committed Nov 23, 2023
1 parent 2958f15 commit 0d1be62
Showing 1 changed file with 11 additions and 19 deletions.
30 changes: 11 additions & 19 deletions app/frontend/src/mocks/mogaco.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,23 +67,15 @@ export const mogacoAPIHandlers = [
http.get('/mogaco/:id/participants', ({ params: { id } }) =>
HttpResponse.json<Participant[]>(participantsList[Number(id) - 1]),
),
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);
},
),
http.post('mogaco/:id/join', async ({ params: { id } }) => {
participantsList[Number(id) - 1] = [
...participantsList[Number(id) - 1],
userList[0],
];
}),
http.delete('mogaco/:id/join', async ({ params: { id } }) => {
participantsList[Number(id) - 1] = participantsList[Number(id) - 1].filter(
(participant) => participant.id !== userList[0].id,
);
}),
];

0 comments on commit 0d1be62

Please sign in to comment.