feat(library) : search

This commit is contained in:
Julien Froidefond
2025-02-22 16:35:01 +01:00
parent 880b97d42d
commit 886ed87f1a
6 changed files with 134 additions and 25 deletions

View File

@@ -33,7 +33,8 @@ export class LibraryService extends BaseApiService {
libraryId: string,
page: number = 0,
size: number = 20,
unreadOnly: boolean = false
unreadOnly: boolean = false,
search?: string
): Promise<LibraryResponse<Series>> {
try {
const config = await this.getKomgaConfig();
@@ -42,11 +43,12 @@ export class LibraryService extends BaseApiService {
page: page.toString(),
size: size.toString(),
...(unreadOnly && { read_status: "UNREAD,IN_PROGRESS" }),
...(search && { search }),
});
const headers = this.getAuthHeaders(config);
return this.fetchWithCache<LibraryResponse<Series>>(
`library-${libraryId}-series-${page}-${size}-${unreadOnly}`,
`library-${libraryId}-series-${page}-${size}-${unreadOnly}-${search}`,
async () => this.fetchFromApi<LibraryResponse<Series>>(url, headers),
"SERIES"
);
@@ -56,6 +58,6 @@ export class LibraryService extends BaseApiService {
}
static async clearLibrarySeriesCache(libraryId: string) {
serverCacheService.delete(`library-${libraryId}-series`);
serverCacheService.deleteAll(`library-${libraryId}-series`);
}
}