Merge pull request #217 from ltctceplrm/master

Fixed undefined property bug in openlibrary
This commit is contained in:
Moritz Jung 2025-09-23 10:32:46 +02:00 committed by GitHub
commit 9cca087974
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -66,7 +66,7 @@ export class OpenLibraryAPI extends APIModel {
new BookModel({
title: result.title,
englishTitle: result.title,
year: result.first_publish_year.toString(),
year: result.first_publish_year?.toString() ?? 'unknown',
dataSource: this.apiName,
id: result.key,
author: result.author_name.join(', '),
@ -111,7 +111,7 @@ export class OpenLibraryAPI extends APIModel {
return new BookModel({
title: result.title,
year: result.first_publish_year.toString(),
year: result.first_publish_year?.toString() ?? 'unknown',
dataSource: this.apiName,
url: `https://openlibrary.org` + result.key,
id: result.key,