Skip to content

Commit

Permalink
fix: fix taken lecture handler
Browse files Browse the repository at this point in the history
  • Loading branch information
gahyuun committed Jun 28, 2024
1 parent f2cdf27 commit cd88b24
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions app/mocks/handlers/taken-lecture-handler.mock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,11 @@ export const takenLectureHandlers = [
if (isAdded) return HttpResponse.json({ message: '과목 추가에 성공했습니다' }, { status: 200 });
return HttpResponse.json({ errorCode: 400, message: '추가에 실패했습니다' }, { status: 400 });
}),
http.delete<never, { lectureId: number }>(API_PATH.takenLectures, async ({ request }) => {
const body = await request.json();
const isDeleted = mockDatabase.deleteTakenLecture(body.lectureId);
http.delete<never, { lectureId: number }>(`${API_PATH.takenLectures}/:id`, async ({ request }) => {
const url = new URL(request.url);
// url.pathname.split("/") 의 결과 : ['','taken-lectures',120]
const lectureId = Number(url.pathname.split('/')[2]);
const isDeleted = mockDatabase.deleteTakenLecture(lectureId);
await delay(1000);
if (isDeleted) {
return HttpResponse.json({ message: '삭제되었습니다' }, { status: 200 });
Expand Down

0 comments on commit cd88b24

Please sign in to comment.