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 df58e9f commit 7c22032
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions app/frontend/src/mocks/mogaco.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,23 @@ export const mogacoAPIHandlers = [
http.get('/mogaco/:id/participants', ({ params: { id } }) =>
HttpResponse.json<Participant[]>(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);
},
),
];

0 comments on commit 7c22032

Please sign in to comment.