Replaced filter and take rxjs operators with first rxjs operator

This commit is contained in:
Giuseppe Digilio
2019-01-24 17:24:07 +01:00
parent f83dba4eff
commit a37a918130

View File

@@ -1,4 +1,4 @@
import { distinctUntilChanged, filter, first, map, take } from 'rxjs/operators'; import { distinctUntilChanged, filter, first, map } from 'rxjs/operators';
import { Observable } from 'rxjs'; import { Observable } from 'rxjs';
import { Store } from '@ngrx/store'; import { Store } from '@ngrx/store';
@@ -81,8 +81,7 @@ export abstract class DataService<TNormalized extends NormalizedObject, TDomain>
const hrefObs = this.getFindAllHref(options); const hrefObs = this.getFindAllHref(options);
hrefObs.pipe( hrefObs.pipe(
filter((href: string) => hasValue(href)), first((href: string) => hasValue(href)))
take(1))
.subscribe((href: string) => { .subscribe((href: string) => {
const request = new FindAllRequest(this.requestService.generateRequestId(), href, options); const request = new FindAllRequest(this.requestService.generateRequestId(), href, options);
this.requestService.configure(request, this.forceBypassCache); this.requestService.configure(request, this.forceBypassCache);
@@ -125,8 +124,7 @@ export abstract class DataService<TNormalized extends NormalizedObject, TDomain>
const hrefObs = this.getSearchByHref(searchMethod, options); const hrefObs = this.getSearchByHref(searchMethod, options);
hrefObs.pipe( hrefObs.pipe(
filter((href: string) => hasValue(href)), first((href: string) => hasValue(href)))
take(1))
.subscribe((href: string) => { .subscribe((href: string) => {
const request = new FindAllRequest(this.requestService.generateRequestId(), href, options); const request = new FindAllRequest(this.requestService.generateRequestId(), href, options);
this.requestService.configure(request, true); this.requestService.configure(request, true);