modify file upload..

This commit is contained in:
2026-07-08 14:07:37 +09:00
parent e63b1c6f43
commit f67ddb7bec
2 changed files with 21 additions and 4 deletions
+7 -2
View File
@@ -89,6 +89,11 @@ export type InstructorCurriculumResponse = {
const LMS_API_BASE_URL = (import.meta.env.VITE_API_BASE_URL ?? 'https://workspace.autonomystudio.net/lms-api/api').replace(/\/+$/, '');
function uploadErrorMessage(status: number, fallback: string) {
if (status === 413) return '파일 용량이 업로드 제한을 초과했습니다. 관리자에게 업로드 허용 용량 설정을 확인해 주세요.';
return `${fallback} (${status})`;
}
export async function getInstructorCurriculum(accessToken: string, groupId?: string | null, courseId?: string | null): Promise<InstructorCurriculumResponse> {
const params = new URLSearchParams();
if (groupId) params.set('groupId', groupId);
@@ -208,7 +213,7 @@ export async function uploadCurriculumReference(
const message =
payload && typeof payload === 'object' && 'message' in payload
? String(payload.message)
: `참고자료를 업로드하지 못했습니다. (${response.status})`;
: uploadErrorMessage(response.status, '참고자료를 업로드하지 못했습니다.');
throw new Error(message);
}
@@ -242,7 +247,7 @@ export async function uploadCurriculumExampleCode(
const message =
payload && typeof payload === 'object' && 'message' in payload
? String(payload.message)
: `예제 코드를 업로드하지 못했습니다. (${response.status})`;
: uploadErrorMessage(response.status, '예제 코드를 업로드하지 못했습니다.');
throw new Error(message);
}
+14 -2
View File
@@ -474,7 +474,13 @@ export function CurriculumPage({ session, selectedCourseId }: { session: AuthSes
message: referenceFile.name,
});
} catch (reason) {
setError(reason instanceof Error ? reason.message : '참고자료를 업로드하지 못했습니다.');
const message = reason instanceof Error ? reason.message : '참고자료를 업로드하지 못했습니다.';
setError(message);
showToast({
title: '참고자료 업로드 실패',
message,
variant: 'error',
});
} finally {
setSaving(false);
}
@@ -502,7 +508,13 @@ export function CurriculumPage({ session, selectedCourseId }: { session: AuthSes
message: exampleCodeFile.name,
});
} catch (reason) {
setError(reason instanceof Error ? reason.message : '예제 코드를 업로드하지 못했습니다.');
const message = reason instanceof Error ? reason.message : '예제 코드를 업로드하지 못했습니다.';
setError(message);
showToast({
title: '예제 코드 업로드 실패',
message,
variant: 'error',
});
} finally {
setSaving(false);
}