-
diff --git a/frontend/src/app/components/game-detail-view/game-detail-view.component.ts b/frontend/src/app/components/game-detail-view/game-detail-view.component.ts
index 64921a9..89e99b8 100644
--- a/frontend/src/app/components/game-detail-view/game-detail-view.component.ts
+++ b/frontend/src/app/components/game-detail-view/game-detail-view.component.ts
@@ -3,6 +3,7 @@ import {ActivatedRoute, Router} from "@angular/router";
import {DetectedGameDto} from "../../models/dtos/DetectedGameDto";
import {GamesService} from "../../services/games.service";
import {HttpErrorResponse} from "@angular/common/http";
+import {takeWhile} from "rxjs";
@Component({
selector: 'app-game-detail-view',
@@ -33,4 +34,8 @@ export class GameDetailViewComponent implements OnInit {
ngOnInit(): void {
}
+ downloadGame(): void {
+ this.gamesService.downloadGame(this.game.slug);
+ }
+
}
diff --git a/frontend/src/app/components/header/header.component.ts b/frontend/src/app/components/header/header.component.ts
index 349f08d..9f19dcd 100644
--- a/frontend/src/app/components/header/header.component.ts
+++ b/frontend/src/app/components/header/header.component.ts
@@ -18,8 +18,8 @@ export class HeaderComponent {
reloadLibrary(): void {
this.libraryService.scanLibrary().pipe(timeInterval()).subscribe({
- next: value => this.snackBar.open(`Library scan completed in ${Math.trunc(value.interval / 1000)} seconds.`),
- error: error => this.snackBar.open(`Error while scanning library: ${error}`)
+ next: value => this.snackBar.open(`Library scan completed in ${Math.trunc(value.interval / 1000)} seconds.`, undefined, {duration: 2000}),
+ error: error => this.snackBar.open(`Error while scanning library: ${error}`, undefined, {duration: 5000})
})
}
diff --git a/frontend/src/app/services/games.service.ts b/frontend/src/app/services/games.service.ts
index b7fadbf..00b88cf 100644
--- a/frontend/src/app/services/games.service.ts
+++ b/frontend/src/app/services/games.service.ts
@@ -23,6 +23,10 @@ export class GamesService implements GamesApi {
return this.http.get
(`${this.apiPath}/game/${slug}`);
}
+ downloadGame(slug: String): void {
+ window.open(`v1/${this.apiPath}/game/${slug}/download`, '_top');
+ }
+
getGameOverviews(): Observable {
return this.http.get(`${this.apiPath}/game-overviews`);
}