diff --git a/src/lib/data/catalogData.ts b/src/lib/data/catalogData.ts index b4bd2cd0a..c66189d21 100644 --- a/src/lib/data/catalogData.ts +++ b/src/lib/data/catalogData.ts @@ -23,7 +23,7 @@ export interface CatalogData { }[]; tags: {}; quizzes: {}; - htmlBooks: { + htmlBooks?: { id: string; name: string; }[]; diff --git a/src/lib/data/navigation.ts b/src/lib/data/navigation.ts index a293b2a4c..15f8cbd7f 100644 --- a/src/lib/data/navigation.ts +++ b/src/lib/data/navigation.ts @@ -74,7 +74,10 @@ export class NavigationContext { this.collection = docSet.split('_')[1]; this.catalog = await this.fetchCatalog(this.docSet); this.books = this.catalog.documents.map((b) => b.bookCode); - this.allBookIds = [...this.books, ...this.catalog.htmlBooks.map((b) => b.id)]; + this.allBookIds = [ + ...this.books, + ...(this.catalog.htmlBooks ? this.catalog.htmlBooks.map((b) => b.id) : []) + ]; newBook = true; } if (book !== this.book && this.allBookIds.includes(book)) { @@ -128,7 +131,7 @@ export class NavigationContext { return; } - const htmlBook = this.catalog.htmlBooks.find((b) => b.id === this.book); + const htmlBook = this.catalog.htmlBooks?.find((b) => b.id === this.book); if (htmlBook) { this.title = htmlBook.name; this.name = htmlBook.name;