add commits..
This commit is contained in:
@@ -24,3 +24,20 @@ export async function listInstructorCourses(accessToken: string): Promise<{ cour
|
||||
if (!response.ok) throw new Error(`강좌 목록을 불러오지 못했습니다. (${response.status})`);
|
||||
return response.json() as Promise<{ courses: InstructorCourse[] }>;
|
||||
}
|
||||
|
||||
export async function createInitialInstructorCourse(accessToken: string, title: string): Promise<{ course: InstructorCourse }> {
|
||||
const response = await fetch(`${LMS_API_BASE_URL}/instructor/courses/initial`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
Authorization: `Bearer ${accessToken}`,
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify({ title }),
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
const payload = await response.json().catch(() => null) as { message?: string } | null;
|
||||
throw new Error(payload?.message || `강좌를 생성하지 못했습니다. (${response.status})`);
|
||||
}
|
||||
return response.json() as Promise<{ course: InstructorCourse }>;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user