fix: correct curriculum week deletion and include selected course ID

This commit is contained in:
2026-09-22 15:32:54 +09:00
parent f1f6df8b1c
commit 8bbcb35998
3 changed files with 7 additions and 3 deletions
+1
View File
@@ -451,6 +451,7 @@ export function InstructorLayout({ session, route, onNavigate, onLogout, courses
</div>
<div className="min-w-0">
<p className="truncate text-[14px] font-black text-[#111827]">{displayName}</p>
<p className="mt-1 break-all text-[11px] leading-4 text-[#64748b]">{session.user.email}</p>
</div>
</div>
+4 -1
View File
@@ -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<InstructorCurriculumResponse> {
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}`,
+2 -2
View File
@@ -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: '주차가 삭제되었습니다.',