diff --git a/src/app/core/data/site-data.service.ts b/src/app/core/data/site-data.service.ts index 1d41af1f022..bd7299c3d7b 100644 --- a/src/app/core/data/site-data.service.ts +++ b/src/app/core/data/site-data.service.ts @@ -46,17 +46,27 @@ export class SiteDataService extends IdentifiableDataService implements Fi /** * Retrieve the Site Object + * + * @param options Find list options object + * @param useCachedVersionIfAvailable If this is true, the request will only be sent if there's + * no valid cached version. Defaults to true + * @param reRequestOnStale Whether or not the request should automatically be re- + * requested after the response becomes stale + * @param linksToFollow List of {@link FollowLinkConfig} that indicate which + * {@link HALLink}s should be automatically resolved + * @return {Observable>>} + * Return an observable that emits object list */ - find(): Observable { + find(options?: FindListOptions, useCachedVersionIfAvailable?: boolean, reRequestOnStale?: boolean, ...linksToFollow: FollowLinkConfig[]): Observable { const searchParams: RequestParam[] = [new RequestParam('projection', 'allLanguages')]; - const options = Object.assign(new FindListOptions(), { searchParams }); - return this.findAll(options).pipe( + const findOptions = Object.assign(new FindListOptions(), options, { searchParams }); + return this.findAll(findOptions, useCachedVersionIfAvailable, reRequestOnStale, ...linksToFollow).pipe( getFirstCompletedRemoteData(), switchMap((remoteData: RemoteData>) => { if (remoteData.hasSucceeded) { return of(remoteData.payload.page[0]); } else { - return this.findAll().pipe( + return this.findAll(options, useCachedVersionIfAvailable, reRequestOnStale, ...linksToFollow).pipe( getFirstCompletedRemoteData(), map((rd: RemoteData>) => rd.hasSucceeded ? rd.payload.page[0] : null) ); diff --git a/src/app/home-page/home-page.resolver.ts b/src/app/home-page/home-page.resolver.ts index 6b63a4e782d..f1a303e732a 100644 --- a/src/app/home-page/home-page.resolver.ts +++ b/src/app/home-page/home-page.resolver.ts @@ -20,6 +20,6 @@ export class HomePageResolver implements Resolve { * @returns Observable Emits the found Site object, or an error if something went wrong */ resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable | Promise | Site { - return this.siteService.find().pipe(take(1)); + return this.siteService.find(null, false).pipe(take(1)); } }