feat(home): latest series
This commit is contained in:
@@ -7,6 +7,7 @@ interface HomeData {
|
|||||||
ongoing: KomgaSeries[];
|
ongoing: KomgaSeries[];
|
||||||
recentlyRead: KomgaBook[];
|
recentlyRead: KomgaBook[];
|
||||||
onDeck: KomgaBook[];
|
onDeck: KomgaBook[];
|
||||||
|
latestSeries: KomgaSeries[];
|
||||||
}
|
}
|
||||||
|
|
||||||
interface HomeContentProps {
|
interface HomeContentProps {
|
||||||
@@ -68,6 +69,10 @@ export function HomeContent({ data, refreshHome }: HomeContentProps) {
|
|||||||
<MediaRow title="À suivre" items={optimizeBookData(data.onDeck)} />
|
<MediaRow title="À suivre" items={optimizeBookData(data.onDeck)} />
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
{data.latestSeries && data.latestSeries.length > 0 && (
|
||||||
|
<MediaRow title="Dernières séries" items={optimizeSeriesData(data.latestSeries)} />
|
||||||
|
)}
|
||||||
|
|
||||||
{data.recentlyRead && data.recentlyRead.length > 0 && (
|
{data.recentlyRead && data.recentlyRead.length > 0 && (
|
||||||
<MediaRow title="Ajouts récents" items={optimizeBookData(data.recentlyRead)} />
|
<MediaRow title="Ajouts récents" items={optimizeBookData(data.recentlyRead)} />
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -7,13 +7,14 @@ interface HomeData {
|
|||||||
ongoing: KomgaSeries[];
|
ongoing: KomgaSeries[];
|
||||||
recentlyRead: KomgaBook[];
|
recentlyRead: KomgaBook[];
|
||||||
onDeck: KomgaBook[];
|
onDeck: KomgaBook[];
|
||||||
|
latestSeries: KomgaSeries[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export class HomeService extends BaseApiService {
|
export class HomeService extends BaseApiService {
|
||||||
static async getHomeData(): Promise<HomeData> {
|
static async getHomeData(): Promise<HomeData> {
|
||||||
try {
|
try {
|
||||||
// Appels API parallèles avec cache individuel
|
// Appels API parallèles avec cache individuel
|
||||||
const [ongoing, recentlyRead, onDeck] = await Promise.all([
|
const [ongoing, recentlyRead, onDeck, latestSeries] = await Promise.all([
|
||||||
this.fetchWithCache<LibraryResponse<KomgaSeries>>(
|
this.fetchWithCache<LibraryResponse<KomgaSeries>>(
|
||||||
"home-ongoing",
|
"home-ongoing",
|
||||||
async () =>
|
async () =>
|
||||||
@@ -55,12 +56,26 @@ export class HomeService extends BaseApiService {
|
|||||||
}),
|
}),
|
||||||
"HOME"
|
"HOME"
|
||||||
),
|
),
|
||||||
|
this.fetchWithCache<LibraryResponse<KomgaSeries>>(
|
||||||
|
"home-latest-series",
|
||||||
|
async () =>
|
||||||
|
this.fetchFromApi<LibraryResponse<KomgaSeries>>({
|
||||||
|
path: "series/latest",
|
||||||
|
params: {
|
||||||
|
page: "0",
|
||||||
|
size: "10",
|
||||||
|
media_status: "READY",
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
"HOME"
|
||||||
|
),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
ongoing: ongoing.content || [],
|
ongoing: ongoing.content || [],
|
||||||
recentlyRead: recentlyRead.content || [],
|
recentlyRead: recentlyRead.content || [],
|
||||||
onDeck: onDeck.content || [],
|
onDeck: onDeck.content || [],
|
||||||
|
latestSeries: latestSeries.content || [],
|
||||||
};
|
};
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
return this.handleError(error, "Impossible de récupérer les données de la page d'accueil");
|
return this.handleError(error, "Impossible de récupérer les données de la page d'accueil");
|
||||||
|
|||||||
Reference in New Issue
Block a user