Interfaces: add genres to api responses

This commit is contained in:
Toast 2025-02-07 18:34:35 +01:00
parent 1dd0333bc3
commit 70f7738966
3 changed files with 7 additions and 3 deletions

View file

@ -1,6 +1,8 @@
import {Show} from './show'; import {Show} from './show';
import {Genre} from './genre';
export interface ApiIdResponse { export interface ApiIdResponse {
status: string status: string
show: Show show?: Show
genre?: Genre
} }

View file

@ -1,7 +1,9 @@
import {Show} from './show'; import {Show} from './show';
import {Genre} from './genre';
export interface ApiResponse { export interface ApiResponse {
status: string status: string
shows: Show[] shows?: Show[]
genres?: Genre[]
totalShows: number totalShows: number
} }

View file

@ -30,7 +30,7 @@ export class ShowsComponent {
this.toastService.show(loadToast); this.toastService.show(loadToast);
this.api.getShows().subscribe({ this.api.getShows().subscribe({
next: (response: ApiResponse) => { next: (response: ApiResponse) => {
this.shows = response.shows; this.shows = response.shows ?? [];
}, error: (err: any) => { }, error: (err: any) => {
console.error("Error: ", err); console.error("Error: ", err);
}, complete: () => { }, complete: () => {