From 70f7738966b3c3e53ef55b643fa2938dc7090f04 Mon Sep 17 00:00:00 2001 From: Toast Date: Fri, 7 Feb 2025 18:34:35 +0100 Subject: [PATCH] Interfaces: add genres to api responses --- src/interfaces/api-id-response.ts | 4 +++- src/interfaces/api-response.ts | 4 +++- src/pages/shows/shows.component.ts | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) 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: () => {