fixed book loading on anilist entries

This commit is contained in:
2025-12-03 00:39:49 +01:00
parent f479d87584
commit 2cad7ff6ea

View File

@@ -271,10 +271,9 @@ export async function getChaptersForBook(id: string): Promise<{ chapters: Chapte
let searchTitle: string = "";
if (!isNaN(Number(id))) {
bookData = await fetchBookMetadata(id);
if (!bookData) {
return { chapters: [] };
}
const result = await getBookById(id);
if (!result || "error" in result) return { chapters: [] }
bookData = result;
const titles = [bookData.title.english, bookData.title.romaji].filter(Boolean) as string[];
searchTitle = titles[0];
}