From cd88b24806f5b00e5986b9fa2c524826117fffd7 Mon Sep 17 00:00:00 2001 From: gahyuun Date: Sat, 29 Jun 2024 00:09:31 +0900 Subject: [PATCH] fix: fix taken lecture handler --- app/mocks/handlers/taken-lecture-handler.mock.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app/mocks/handlers/taken-lecture-handler.mock.ts b/app/mocks/handlers/taken-lecture-handler.mock.ts index cf01da40..1f336221 100644 --- a/app/mocks/handlers/taken-lecture-handler.mock.ts +++ b/app/mocks/handlers/taken-lecture-handler.mock.ts @@ -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(API_PATH.takenLectures, async ({ request }) => { - const body = await request.json(); - const isDeleted = mockDatabase.deleteTakenLecture(body.lectureId); + http.delete(`${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 });