From 93afbd9e01073e711a166dae25d323adbbaf7ea8 Mon Sep 17 00:00:00 2001 From: Zoe Roux Date: Sun, 7 Mar 2021 00:49:19 +0100 Subject: [PATCH] Fixing show's details studio/genres dependency --- src/app/app-routing.module.ts | 2 +- .../pages/show-details/show-details.component.ts | 16 ++++++++++++---- src/app/services/item-resolver.service.ts | 2 +- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index 1e6f32eb..9d729f42 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -73,7 +73,7 @@ const routes: Routes = [ }, {path: "show/:slug", component: ShowDetailsComponent, - resolve: {show: ItemResolver.forResource("shows/:slug")}, + resolve: {show: ItemResolver.forResource("shows/:slug?fields=studio,genres")}, canLoad: [AuthGuard.forPermissions("read")], canActivate: [AuthGuard.forPermissions("read")] }, diff --git a/src/app/pages/show-details/show-details.component.ts b/src/app/pages/show-details/show-details.component.ts index 9509bd9b..80096bcf 100644 --- a/src/app/pages/show-details/show-details.component.ts +++ b/src/app/pages/show-details/show-details.component.ts @@ -123,12 +123,18 @@ export class ShowDetailsComponent implements AfterViewInit, OnDestroy 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 { - 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) { this.show = result; @@ -138,7 +144,8 @@ export class ShowDetailsComponent implements AfterViewInit, OnDestroy 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); this.snackBar.open("An unknown error occurred while re-downloading images.", null, { @@ -151,7 +158,8 @@ export class ShowDetailsComponent implements AfterViewInit, OnDestroy 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); this.snackBar.open("An unknown error occurred while re-downloading images.", null, { diff --git a/src/app/services/item-resolver.service.ts b/src/app/services/item-resolver.service.ts index aa6b71c2..85c4cf20 100644 --- a/src/app/services/item-resolver.service.ts +++ b/src/app/services/item-resolver.service.ts @@ -21,7 +21,7 @@ export class ItemResolver resolve(route: ActivatedRouteSnapshot): T | Observable | Promise { - 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(`api/${res}`) .pipe(