mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 10:04:11 +00:00
apply cache changes to root dataservice
This commit is contained in:
@@ -30,7 +30,7 @@ describe('RootDataService', () => {
|
|||||||
|
|
||||||
it('should call findByHref using the root endpoint', (done) => {
|
it('should call findByHref using the root endpoint', (done) => {
|
||||||
result$.subscribe(() => {
|
result$.subscribe(() => {
|
||||||
expect((service as any).dataService.findByHref).toHaveBeenCalledWith(rootEndpoint, true);
|
expect((service as any).dataService.findByHref).toHaveBeenCalledWith(rootEndpoint, true, true);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@@ -65,39 +65,46 @@ export class RootDataService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Find the {@link Root} object of the REST API
|
* Find the {@link Root} object of the REST API
|
||||||
* @param reRequestOnStale Whether or not the request should automatically be re-requested after
|
* @param useCachedVersionIfAvailable If this is true, the request will only be sent if there's
|
||||||
* the response becomes stale
|
* no valid cached version. Defaults to true
|
||||||
* @param linksToFollow List of {@link FollowLinkConfig} that indicate which {@link HALLink}s should be automatically resolved
|
* @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
|
||||||
*/
|
*/
|
||||||
findRoot(reRequestOnStale = true, ...linksToFollow: FollowLinkConfig<Root>[]): Observable<RemoteData<Root>> {
|
findRoot(useCachedVersionIfAvailable = true, reRequestOnStale = true, ...linksToFollow: FollowLinkConfig<Root>[]): Observable<RemoteData<Root>> {
|
||||||
return this.dataService.findByHref(this.halService.getRootHref(), reRequestOnStale, ...linksToFollow);
|
return this.dataService.findByHref(this.halService.getRootHref(), useCachedVersionIfAvailable, reRequestOnStale, ...linksToFollow);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns an observable of {@link RemoteData} of an object, based on an href, with a list of
|
* Returns an observable of {@link RemoteData} of an object, based on an href, with a list of
|
||||||
* {@link FollowLinkConfig}, to automatically resolve {@link HALLink}s of the object
|
* {@link FollowLinkConfig}, to automatically resolve {@link HALLink}s of the object
|
||||||
* @param href The url of object we want to retrieve
|
* @param href The url of object we want to retrieve
|
||||||
* @param reRequestOnStale Whether or not the request should automatically be re-requested after
|
* @param useCachedVersionIfAvailable If this is true, the request will only be sent if there's
|
||||||
* the response becomes stale
|
* no valid cached version. Defaults to true
|
||||||
* @param linksToFollow List of {@link FollowLinkConfig} that indicate which {@link HALLink}s
|
* @param reRequestOnStale Whether or not the request should automatically be re-
|
||||||
* should be automatically resolved
|
* requested after the response becomes stale
|
||||||
|
* @param linksToFollow List of {@link FollowLinkConfig} that indicate which
|
||||||
|
* {@link HALLink}s should be automatically resolved
|
||||||
*/
|
*/
|
||||||
findByHref(href: string, reRequestOnStale = true, ...linksToFollow: FollowLinkConfig<Root>[]): Observable<RemoteData<Root>> {
|
findByHref(href: string | Observable<string>, useCachedVersionIfAvailable = true, reRequestOnStale = true, ...linksToFollow: FollowLinkConfig<Root>[]): Observable<RemoteData<Root>> {
|
||||||
return this.dataService.findByHref(href, reRequestOnStale, ...linksToFollow);
|
return this.dataService.findByHref(href, useCachedVersionIfAvailable, reRequestOnStale, ...linksToFollow);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a list of observables of {@link RemoteData} of objects, based on an href, with a list
|
* Returns a list of observables of {@link RemoteData} of objects, based on an href, with a list
|
||||||
* of {@link FollowLinkConfig}, to automatically resolve {@link HALLink}s of the object
|
* of {@link FollowLinkConfig}, to automatically resolve {@link HALLink}s of the object
|
||||||
* @param href The url of object we want to retrieve
|
* @param href The url of object we want to retrieve
|
||||||
* @param findListOptions Find list options object
|
* @param findListOptions Find list options object
|
||||||
* @param reRequestOnStale Whether or not the request should automatically be re-requested after
|
* @param useCachedVersionIfAvailable If this is true, the request will only be sent if there's
|
||||||
* the response becomes stale
|
* no valid cached version. Defaults to true
|
||||||
* @param linksToFollow List of {@link FollowLinkConfig} that indicate which {@link HALLink}s
|
* @param reRequestOnStale Whether or not the request should automatically be re-
|
||||||
* should be automatically resolved
|
* requested after the response becomes stale
|
||||||
|
* @param linksToFollow List of {@link FollowLinkConfig} that indicate which
|
||||||
|
* {@link HALLink}s should be automatically resolved
|
||||||
*/
|
*/
|
||||||
findAllByHref(href: string, findListOptions: FindListOptions = {}, reRequestOnStale = true, ...linksToFollow: FollowLinkConfig<Root>[]): Observable<RemoteData<PaginatedList<Root>>> {
|
findAllByHref(href: string | Observable<string>, findListOptions: FindListOptions = {}, useCachedVersionIfAvailable = true, reRequestOnStale = true, ...linksToFollow: FollowLinkConfig<Root>[]): Observable<RemoteData<PaginatedList<Root>>> {
|
||||||
return this.dataService.findAllByHref(href, findListOptions, reRequestOnStale, ...linksToFollow);
|
return this.dataService.findAllByHref(href, findListOptions, useCachedVersionIfAvailable, reRequestOnStale, ...linksToFollow);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* tslint:enable:max-classes-per-file */
|
/* tslint:enable:max-classes-per-file */
|
||||||
|
Reference in New Issue
Block a user