Fixing show's details studio/genres dependency

This commit is contained in:
Zoe Roux 2021-03-07 00:49:19 +01:00
parent 1dbbc0a67a
commit 93afbd9e01
3 changed files with 14 additions and 6 deletions

View File

@ -73,7 +73,7 @@ const routes: Routes = [
}, },
{path: "show/:slug", component: ShowDetailsComponent, {path: "show/:slug", component: ShowDetailsComponent,
resolve: {show: ItemResolver.forResource<Show>("shows/:slug")}, resolve: {show: ItemResolver.forResource<Show>("shows/:slug?fields=studio,genres")},
canLoad: [AuthGuard.forPermissions("read")], canLoad: [AuthGuard.forPermissions("read")],
canActivate: [AuthGuard.forPermissions("read")] canActivate: [AuthGuard.forPermissions("read")]
}, },

View File

@ -123,12 +123,18 @@ export class ShowDetailsComponent implements AfterViewInit, OnDestroy
openTrailer(): void openTrailer(): void
{ {
this.dialog.open(TrailerDialogComponent, {width: "80%", height: "45vw", data: this.show.trailerUrl, panelClass: "panel"}); this.dialog.open(TrailerDialogComponent, {
width: "80%",
height: "45vw",
data: this.show.trailerUrl,
panelClass: "panel"
});
} }
editMetadata(): void editMetadata(): void
{ {
this.dialog.open(MetadataEditComponent, {width: "80%", data: this.show}).afterClosed().subscribe((result: Show) => this.dialog.open(MetadataEditComponent, {width: "80%", data: this.show})
.afterClosed().subscribe((result: Show) =>
{ {
if (result) { if (result) {
this.show = result; this.show = result;
@ -138,7 +144,8 @@ export class ShowDetailsComponent implements AfterViewInit, OnDestroy
redownloadImages(): void redownloadImages(): void
{ {
this.http.put(`api/task/extract/show/${this.show.slug}/thumbnails`, undefined).subscribe(() => { }, error => this.http.put(`api/task/extract/show/${this.show.slug}/thumbnails`, undefined)
.subscribe(() => { }, error =>
{ {
console.log(error.status + " - " + error.message); console.log(error.status + " - " + error.message);
this.snackBar.open("An unknown error occurred while re-downloading images.", null, { this.snackBar.open("An unknown error occurred while re-downloading images.", null, {
@ -151,7 +158,8 @@ export class ShowDetailsComponent implements AfterViewInit, OnDestroy
extractSubs(): void extractSubs(): void
{ {
this.http.put(`api/task/extract/show/${this.show.slug}/subs`, undefined).subscribe(() => { }, error => this.http.put(`api/task/extract/show/${this.show.slug}/subs`, undefined)
.subscribe(() => { }, error =>
{ {
console.log(error.status + " - " + error.message); console.log(error.status + " - " + error.message);
this.snackBar.open("An unknown error occurred while re-downloading images.", null, { this.snackBar.open("An unknown error occurred while re-downloading images.", null, {

View File

@ -21,7 +21,7 @@ export class ItemResolver
resolve(route: ActivatedRouteSnapshot): T | Observable<T> | Promise<T> resolve(route: ActivatedRouteSnapshot): T | Observable<T> | Promise<T>
{ {
const res: string = resource.replace(/:(.*?)(\/|$)/g, (x, y) => `${route.paramMap.get(y)}/`); const res: string = resource.replace(/:(.*?)(\/|\?|$)/g, (x, y, z) => `${route.paramMap.get(y)}${z}`);
return this.http.get<T>(`api/${res}`) return this.http.get<T>(`api/${res}`)
.pipe( .pipe(