feat: add managed learning paths
This commit is contained in:
@@ -44,6 +44,23 @@ type ApiCourse = {
|
||||
assets: ApiAsset[];
|
||||
};
|
||||
|
||||
export type PublicLearningPath = {
|
||||
id: string;
|
||||
title: string;
|
||||
description: string;
|
||||
coverImageUrl: string | null;
|
||||
coverImageZoom: number;
|
||||
coverImagePositionX: number;
|
||||
coverImagePositionY: number;
|
||||
courses: Array<{
|
||||
id: string;
|
||||
title: string;
|
||||
category: string;
|
||||
coverImageUrl: string | null;
|
||||
position: number;
|
||||
}>;
|
||||
};
|
||||
|
||||
const toAttachmentType = (kind: ApiAsset['kind']): AttachmentType => {
|
||||
if (kind === 'document') return 'doc';
|
||||
if (kind === 'archive') return 'zip';
|
||||
@@ -173,6 +190,11 @@ export const getCourses = async (): Promise<Course[]> => {
|
||||
return response.data.map(toCourse);
|
||||
};
|
||||
|
||||
export const getLearningPaths = async (): Promise<PublicLearningPath[]> => {
|
||||
const response = await apiRequest<{ data: PublicLearningPath[] }>('/courses/paths');
|
||||
return response.data;
|
||||
};
|
||||
|
||||
export const getManagedCourses = async (): Promise<Course[]> => {
|
||||
const response = await apiRequest<{ data: ApiCourse[] }>('/manage/courses');
|
||||
return response.data.map(toCourse);
|
||||
|
||||
Reference in New Issue
Block a user