mirror of
https://github.com/BrenBroZAYT/gameyfin.git
synced 2026-06-16 16:20:04 +00:00
WIP: Proceed with frontend implementation
This commit is contained in:
@@ -1,4 +1,8 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import {ActivatedRoute, Router} from "@angular/router";
|
||||
import {DetectedGameDto} from "../../models/dtos/DetectedGameDto";
|
||||
import {GamesService} from "../../services/games.service";
|
||||
import {HttpErrorResponse} from "@angular/common/http";
|
||||
|
||||
@Component({
|
||||
selector: 'app-game-detail-view',
|
||||
@@ -7,7 +11,24 @@ import { Component, OnInit } from '@angular/core';
|
||||
})
|
||||
export class GameDetailViewComponent implements OnInit {
|
||||
|
||||
constructor() { }
|
||||
game!: DetectedGameDto;
|
||||
|
||||
constructor(private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private gamesService: GamesService) {
|
||||
this.route.params.subscribe( params => {
|
||||
this.gamesService.getGame(params['slug']).subscribe({
|
||||
next: game => this.game = game,
|
||||
error: error => {
|
||||
if(error.status === 404) {
|
||||
this.router.navigate(['/library']);
|
||||
} else {
|
||||
console.error(error);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user