diff --git a/src/Ombi/ClientApp/app/requests/remainingrequests.component.ts b/src/Ombi/ClientApp/app/requests/remainingrequests.component.ts index 980256d69..8a13d2cfb 100644 --- a/src/Ombi/ClientApp/app/requests/remainingrequests.component.ts +++ b/src/Ombi/ClientApp/app/requests/remainingrequests.component.ts @@ -23,7 +23,7 @@ export class RemainingRequestsComponent implements OnInit { this.update(); - this.requestService.onRequested().subscribe(m => { + this.requestService.requestEvents.subscribe(() => { this.update(); }); diff --git a/src/Ombi/ClientApp/app/search/moviesearch.component.ts b/src/Ombi/ClientApp/app/search/moviesearch.component.ts index 965837bae..fece0cc74 100644 --- a/src/Ombi/ClientApp/app/search/moviesearch.component.ts +++ b/src/Ombi/ClientApp/app/search/moviesearch.component.ts @@ -88,6 +88,7 @@ export class MovieSearchComponent implements OnInit { try { this.requestService.requestMovie({ theMovieDbId: searchResult.id }) .subscribe(x => { + this.requestService.requestEvents.next(); this.result = x; if (this.result.result) { this.translate.get("Search.RequestAdded", { title: searchResult.title }).subscribe(x => { diff --git a/src/Ombi/ClientApp/app/search/seriesinformation.component.ts b/src/Ombi/ClientApp/app/search/seriesinformation.component.ts index 5c0088268..91234780d 100644 --- a/src/Ombi/ClientApp/app/search/seriesinformation.component.ts +++ b/src/Ombi/ClientApp/app/search/seriesinformation.component.ts @@ -62,6 +62,7 @@ export class SeriesInformationComponent implements OnInit { this.requestService.requestTv(viewModel) .subscribe(x => { + this.requestService.requestEvents.next(); this.result = x as IRequestEngineResult; if (this.result.result) { this.notificationService.success( diff --git a/src/Ombi/ClientApp/app/search/tvsearch.component.ts b/src/Ombi/ClientApp/app/search/tvsearch.component.ts index a41f34586..e08b84567 100644 --- a/src/Ombi/ClientApp/app/search/tvsearch.component.ts +++ b/src/Ombi/ClientApp/app/search/tvsearch.component.ts @@ -161,6 +161,7 @@ export class TvSearchComponent implements OnInit { this.requestService.requestTv(viewModel) .subscribe(x => { + this.requestService.requestEvents.next(); this.result = x; if (this.result.result) { this.notificationService.success( diff --git a/src/Ombi/ClientApp/app/services/request.service.ts b/src/Ombi/ClientApp/app/services/request.service.ts index a7fbc76bf..a8032d5a9 100644 --- a/src/Ombi/ClientApp/app/services/request.service.ts +++ b/src/Ombi/ClientApp/app/services/request.service.ts @@ -13,15 +13,12 @@ import { IRemainingRequests } from "../interfaces/IRemainingRequests"; @Injectable() export class RequestService extends ServiceHelpers { - private requestEvents = new ReplaySubject(); + public readonly requestEvents = new ReplaySubject(); + constructor(http: HttpClient, public platformLocation: PlatformLocation) { super(http, "/api/v1/Request/", platformLocation); } - public onRequested(): Observable { - return this.requestEvents.asObservable(); - } - public getRemainingMovieRequests(): Observable { return this.http.get(`${this.url}movie/remaining`, {headers: this.headers}); } @@ -31,14 +28,7 @@ export class RequestService extends ServiceHelpers { } public requestMovie(movie: IMovieRequestModel): Observable { - const observer = Observable.create(observer => { - this.http.post(`${this.url}Movie/`, JSON.stringify(movie), {headers: this.headers}).subscribe(m => { - observer.next(m); - this.requestEvents.next(m); - }); - }); - - return observer; + return this.http.post(`${this.url}Movie/`, JSON.stringify(movie), {headers: this.headers}); } public getTotalMovies(): Observable { @@ -50,14 +40,7 @@ export class RequestService extends ServiceHelpers { } public requestTv(tv: ITvRequestViewModel): Observable { - const observer = Observable.create(observer => { - return this.http.post(`${this.url}TV/`, JSON.stringify(tv), { headers: this.headers }).subscribe(m => { - observer.next(m); - this.requestEvents.next(m); - }); - }); - - return observer; + return this.http.post(`${this.url}TV/`, JSON.stringify(tv), { headers: this.headers }); } public approveMovie(movie: IMovieUpdateModel): Observable {