diff --git a/src/interfaces/api-id-response.ts b/src/interfaces/api-id-response.ts index 415fa72..e667657 100644 --- a/src/interfaces/api-id-response.ts +++ b/src/interfaces/api-id-response.ts @@ -1,6 +1,8 @@ import {Show} from './show'; +import {Genre} from './genre'; export interface ApiIdResponse { status: string - show: Show + show?: Show + genre?: Genre } diff --git a/src/interfaces/api-response.ts b/src/interfaces/api-response.ts index 80645c0..dfede6f 100644 --- a/src/interfaces/api-response.ts +++ b/src/interfaces/api-response.ts @@ -1,7 +1,9 @@ import {Show} from './show'; +import {Genre} from './genre'; export interface ApiResponse { status: string - shows: Show[] + shows?: Show[] + genres?: Genre[] totalShows: number } diff --git a/src/pages/shows/shows.component.ts b/src/pages/shows/shows.component.ts index 57708b6..65cd046 100644 --- a/src/pages/shows/shows.component.ts +++ b/src/pages/shows/shows.component.ts @@ -30,7 +30,7 @@ export class ShowsComponent { this.toastService.show(loadToast); this.api.getShows().subscribe({ next: (response: ApiResponse) => { - this.shows = response.shows; + this.shows = response.shows ?? []; }, error: (err: any) => { console.error("Error: ", err); }, complete: () => {