Interfaces: add genres to api responses
This commit is contained in:
parent
1dd0333bc3
commit
70f7738966
3 changed files with 7 additions and 3 deletions
|
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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: () => {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue