chore: init lms adm fe
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
export type InstructorCourse = {
|
||||
id: string;
|
||||
slug: string;
|
||||
title: string;
|
||||
subtitle?: string | null;
|
||||
description?: string | null;
|
||||
organizationName: string;
|
||||
teacher?: {
|
||||
id: string;
|
||||
name?: string | null;
|
||||
email: string;
|
||||
};
|
||||
};
|
||||
|
||||
const LMS_API_BASE_URL = (import.meta.env.VITE_API_BASE_URL ?? 'http://localhost:4400/api').replace(/\/+$/, '');
|
||||
|
||||
export async function listInstructorCourses(accessToken: string): Promise<{ courses: InstructorCourse[] }> {
|
||||
const response = await fetch(`${LMS_API_BASE_URL}/instructor/courses`, {
|
||||
headers: {
|
||||
Authorization: `Bearer ${accessToken}`,
|
||||
},
|
||||
});
|
||||
|
||||
if (!response.ok) throw new Error(`강좌 목록을 불러오지 못했습니다. (${response.status})`);
|
||||
return response.json() as Promise<{ courses: InstructorCourse[] }>;
|
||||
}
|
||||
Reference in New Issue
Block a user