feat: manage homepage banner carousel
This commit is contained in:
@@ -62,6 +62,22 @@ export type PublicLearningPath = {
|
||||
}>;
|
||||
};
|
||||
|
||||
export type PublicHomeBanner = {
|
||||
id: string;
|
||||
kind: 'course' | 'custom';
|
||||
courseId: string | null;
|
||||
imageUrl: string | null;
|
||||
title: string;
|
||||
description: string;
|
||||
position: number;
|
||||
courseTitle: string | null;
|
||||
courseDescription: string | null;
|
||||
courseImageUrl: string | null;
|
||||
coverImageZoom: number | null;
|
||||
coverImagePositionX: number | null;
|
||||
coverImagePositionY: number | null;
|
||||
};
|
||||
|
||||
const toAttachmentType = (kind: ApiAsset['kind']): AttachmentType => {
|
||||
if (kind === 'document') return 'doc';
|
||||
if (kind === 'archive') return 'zip';
|
||||
@@ -196,6 +212,11 @@ export const getLearningPaths = async (): Promise<PublicLearningPath[]> => {
|
||||
return response.data;
|
||||
};
|
||||
|
||||
export const getHomeBanners = async (): Promise<PublicHomeBanner[]> => {
|
||||
const response = await apiRequest<{ data: PublicHomeBanner[] }>('/courses/home-banners');
|
||||
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