Skip to content

Commit

Permalink
handle empty genre
Browse files Browse the repository at this point in the history
  • Loading branch information
tamland committed Dec 28, 2023
1 parent 43c3640 commit 8e04ba0
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/shared/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -482,9 +482,13 @@ export class API {
}

private normalizeGenres(item: any): Genre[] {
return item.genres?.length
? item.genres
: [{ name: item.genre }]
if (item.genres?.length) {
return item.genres
}
if (item.genre) {
return [{ name: item.genre }]
}
return []
}

private normalizeAlbum(item: any): Album {
Expand Down

0 comments on commit 8e04ba0

Please sign in to comment.