feat: perf optim search

This commit is contained in:
Julien Froidefond
2025-02-20 22:33:39 +01:00
parent 7166a50cd7
commit b62b44eab9
12 changed files with 175 additions and 142 deletions

View File

@@ -57,12 +57,10 @@ export class SeriesService extends BaseApiService {
return this.fetchWithCache<string>(
`series-first-book-${seriesId}`,
async () => {
const response = await fetch(`${url}?page=0&size=1`, { headers });
if (!response.ok) {
throw new Error(`Erreur HTTP: ${response.status}`);
}
const data = await response.json();
const data = await this.fetchFromApi<LibraryResponse<KomgaBook>>(
`series/${seriesId}/books?page=0&size=1`,
headers
);
if (!data.content || data.content.length === 0) {
throw new Error("Aucun livre trouvé dans la série");
}