Pages/shows: show shows in a grid

This commit is contained in:
Toast 2025-01-28 11:58:09 +01:00
parent 26d66397e4
commit 46b267d672
2 changed files with 30 additions and 2 deletions

View file

@ -1,4 +1,6 @@
import { Component } from '@angular/core';
import {Component, inject} from '@angular/core';
import {ShowsApiService} from '../../shows/shows-api.service';
import {Show, ShowsApiResponse} from '../../shows/shows-api';
@Component({
selector: 'app-shows',
@ -7,5 +9,19 @@ import { Component } from '@angular/core';
styleUrl: './shows.component.css'
})
export class ShowsComponent {
private api: ShowsApiService = inject(ShowsApiService);
shows: Show[] = [];
constructor() {
this.api.getShows().subscribe({
next: (response: ShowsApiResponse) => {
this.shows = response.shows;
}, error: (err: any) => {
console.error("Error: ", err);
}, complete: () => {
console.log("Loaded shows")
}
})
}
}