From 8bbcb35998b1541bd6c1dd747c6505567a8c34ce Mon Sep 17 00:00:00 2001 From: chyoo Date: Tue, 22 Sep 2026 15:32:54 +0900 Subject: [PATCH] fix: correct curriculum week deletion and include selected course ID --- src/layouts/InstructorLayout.tsx | 1 + src/lib/curriculum.ts | 5 ++++- src/pages/curriculum/CurriculumPage.tsx | 4 ++-- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/layouts/InstructorLayout.tsx b/src/layouts/InstructorLayout.tsx index b74a1c8..fa7f97f 100644 --- a/src/layouts/InstructorLayout.tsx +++ b/src/layouts/InstructorLayout.tsx @@ -451,6 +451,7 @@ export function InstructorLayout({ session, route, onNavigate, onLogout, courses

{displayName}

+

{session.user.email}

diff --git a/src/lib/curriculum.ts b/src/lib/curriculum.ts index 7c4b790..9d6eb1a 100644 --- a/src/lib/curriculum.ts +++ b/src/lib/curriculum.ts @@ -1,4 +1,5 @@ export type CurriculumWeek = { + canDelete?: boolean; week: number; title: string; tags: string[]; @@ -223,8 +224,10 @@ export async function createInstructorCurriculumMap( export async function deleteInstructorCurriculumWeek( accessToken: string, week: number, + courseId?: string | null, ): Promise { - const response = await fetch(`${LMS_API_BASE_URL}/instructor/curriculum/weeks/${week}`, { + const query = courseId ? `?courseId=${encodeURIComponent(courseId)}` : ''; + const response = await fetch(`${LMS_API_BASE_URL}/instructor/curriculum/weeks/${week}${query}`, { method: 'DELETE', headers: { Authorization: `Bearer ${accessToken}`, diff --git a/src/pages/curriculum/CurriculumPage.tsx b/src/pages/curriculum/CurriculumPage.tsx index 8ada6b8..675a949 100644 --- a/src/pages/curriculum/CurriculumPage.tsx +++ b/src/pages/curriculum/CurriculumPage.tsx @@ -156,7 +156,7 @@ export function CurriculumPage({ session, selectedCourseId }: { session: AuthSes const primaryActionDisabled = saving || !selectedWeek || (activeTab === 'apply' && !selectedGroup); const selectedTopics = activeTab === 'edit' ? draftTopics : selectedWeek?.topics ?? []; const selectedTopicDetails = activeTab === 'edit' ? draftTopicDetails : selectedWeek?.detail.topicDetails ?? []; - const selectedWeekDeletable = Boolean(selectedWeek?.tags.includes('추가')); + const selectedWeekDeletable = selectedWeek?.canDelete === true; const tagOptionLabels = useMemo(() => new Set(tagOptions.map((option) => option.label)), [tagOptions]); const selectedTagLabel = tagOptionLabels.has(draftTagLabel) ? draftTagLabel @@ -580,7 +580,7 @@ export function CurriculumPage({ session, selectedCourseId }: { session: AuthSes setError(null); try { - const payload = await deleteInstructorCurriculumWeek(session.accessToken, selectedWeek.week); + const payload = await deleteInstructorCurriculumWeek(session.accessToken, selectedWeek.week, selectedCourseId); applyPayload(payload, { selectProgress: true }); showToast({ title: '주차가 삭제되었습니다.',