mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 10:04:11 +00:00
trying to get request handling in the right order
This commit is contained in:
@@ -113,6 +113,7 @@ export class RemoteDataBuildService {
|
||||
href$ = observableOf(href$);
|
||||
}
|
||||
|
||||
href$.subscribe(href => console.log('request url: ', href));
|
||||
const requestEntry$ = href$.pipe(getRequestFromRequestHref(this.requestService));
|
||||
const tDomainList$ = requestEntry$.pipe(
|
||||
getResourceLinksFromResponse(),
|
||||
|
@@ -1,7 +1,7 @@
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
|
||||
import { Observable } from 'rxjs';
|
||||
import { distinctUntilChanged, filter, find, first, map, mergeMap, switchMap, take } from 'rxjs/operators';
|
||||
import { distinctUntilChanged, filter, find, first, map, mergeMap, switchMap, take, tap } from 'rxjs/operators';
|
||||
import { Store } from '@ngrx/store';
|
||||
|
||||
import { hasValue, isNotEmpty, isNotEmptyOperator } from '../../shared/empty.util';
|
||||
@@ -184,20 +184,20 @@ export abstract class DataService<T extends CacheableObject> {
|
||||
* @return {Observable<RemoteData<PaginatedList<T>>}
|
||||
* Return an observable that emits response from the server
|
||||
*/
|
||||
protected searchBy(searchMethod: string, options: FindAllOptions = {}, refresh: boolean = false): Observable<RemoteData<PaginatedList<T>>> {
|
||||
protected searchBy(searchMethod: string, options: FindAllOptions = {}): Observable<RemoteData<PaginatedList<T>>> {
|
||||
|
||||
const hrefObs = this.getSearchByHref(searchMethod, options);
|
||||
|
||||
hrefObs.pipe(
|
||||
find((href: string) => hasValue(href)))
|
||||
.subscribe((href: string) => {
|
||||
if (refresh) {
|
||||
return hrefObs.pipe(
|
||||
find((href: string) => hasValue(href)),
|
||||
switchMap((href: string) => {
|
||||
this.requestService.removeByHrefSubstring(href);
|
||||
}
|
||||
const request = new FindAllRequest(this.requestService.generateRequestId(), href, options);
|
||||
this.requestService.configure(request, true);
|
||||
});
|
||||
return this.rdbService.buildList<T>(hrefObs) as Observable<RemoteData<PaginatedList<T>>>;
|
||||
return this.rdbService.buildList<T>(href) as Observable<RemoteData<PaginatedList<T>>>
|
||||
}
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -225,7 +225,7 @@ export class RelationshipService extends DataService<Relationship> {
|
||||
} else {
|
||||
findAllOptions.searchParams = searchParams;
|
||||
}
|
||||
return this.searchBy('byLabel', findAllOptions, true);
|
||||
return this.searchBy('byLabel', findAllOptions);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -3,7 +3,7 @@ import { HttpHeaders } from '@angular/common/http';
|
||||
|
||||
import { createSelector, MemoizedSelector, select, Store } from '@ngrx/store';
|
||||
import { Observable, race as observableRace } from 'rxjs';
|
||||
import { filter, map, mergeMap, take } from 'rxjs/operators';
|
||||
import { filter, map, mergeMap, switchMap, take } from 'rxjs/operators';
|
||||
import { cloneDeep, remove } from 'lodash';
|
||||
|
||||
import { AppState } from '../../app.reducer';
|
||||
|
Reference in New Issue
Block a user