fix: correct curriculum week deletion and include selected course ID
This commit is contained in:
@@ -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>
|
||||
|
||||
|
||||
@@ -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}`,
|
||||
|
||||
@@ -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: '주차가 삭제되었습니다.',
|
||||
|
||||
Reference in New Issue
Block a user