mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-14 02:26:55 -07:00
Change way remainingrequests component is notified
This commit is contained in:
parent
93e9b4cd4c
commit
e6f24eabb4
5 changed files with 8 additions and 22 deletions
|
@ -23,7 +23,7 @@ export class RemainingRequestsComponent implements OnInit {
|
|||
|
||||
this.update();
|
||||
|
||||
this.requestService.onRequested().subscribe(m => {
|
||||
this.requestService.requestEvents.subscribe(() => {
|
||||
this.update();
|
||||
});
|
||||
|
||||
|
|
|
@ -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 => {
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -13,15 +13,12 @@ import { IRemainingRequests } from "../interfaces/IRemainingRequests";
|
|||
|
||||
@Injectable()
|
||||
export class RequestService extends ServiceHelpers {
|
||||
private requestEvents = new ReplaySubject<IRequestEngineResult>();
|
||||
public readonly requestEvents = new ReplaySubject();
|
||||
|
||||
constructor(http: HttpClient, public platformLocation: PlatformLocation) {
|
||||
super(http, "/api/v1/Request/", platformLocation);
|
||||
}
|
||||
|
||||
public onRequested(): Observable<IRequestEngineResult> {
|
||||
return this.requestEvents.asObservable();
|
||||
}
|
||||
|
||||
public getRemainingMovieRequests(): Observable<IRemainingRequests> {
|
||||
return this.http.get<IRemainingRequests>(`${this.url}movie/remaining`, {headers: this.headers});
|
||||
}
|
||||
|
@ -31,14 +28,7 @@ export class RequestService extends ServiceHelpers {
|
|||
}
|
||||
|
||||
public requestMovie(movie: IMovieRequestModel): Observable<IRequestEngineResult> {
|
||||
const observer = Observable.create(observer => {
|
||||
this.http.post<IRequestEngineResult>(`${this.url}Movie/`, JSON.stringify(movie), {headers: this.headers}).subscribe(m => {
|
||||
observer.next(m);
|
||||
this.requestEvents.next(m);
|
||||
});
|
||||
});
|
||||
|
||||
return observer;
|
||||
return this.http.post<IRequestEngineResult>(`${this.url}Movie/`, JSON.stringify(movie), {headers: this.headers});
|
||||
}
|
||||
|
||||
public getTotalMovies(): Observable<number> {
|
||||
|
@ -50,14 +40,7 @@ export class RequestService extends ServiceHelpers {
|
|||
}
|
||||
|
||||
public requestTv(tv: ITvRequestViewModel): Observable<IRequestEngineResult> {
|
||||
const observer = Observable.create(observer => {
|
||||
return this.http.post<IRequestEngineResult>(`${this.url}TV/`, JSON.stringify(tv), { headers: this.headers }).subscribe(m => {
|
||||
observer.next(m);
|
||||
this.requestEvents.next(m);
|
||||
});
|
||||
});
|
||||
|
||||
return observer;
|
||||
return this.http.post<IRequestEngineResult>(`${this.url}TV/`, JSON.stringify(tv), { headers: this.headers });
|
||||
}
|
||||
|
||||
public approveMovie(movie: IMovieUpdateModel): Observable<IRequestEngineResult> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue