mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-16 06:23:03 +00:00
[DSC-287] invalidate root endpoint cache when redirected to 500 page in order to check every time the rest server availability
This commit is contained in:
@@ -106,5 +106,12 @@ export class RootDataService {
|
|||||||
findAllByHref(href: string | Observable<string>, findListOptions: FindListOptions = {}, useCachedVersionIfAvailable = true, 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, useCachedVersionIfAvailable, reRequestOnStale, ...linksToFollow);
|
return this.dataService.findAllByHref(href, findListOptions, useCachedVersionIfAvailable, reRequestOnStale, ...linksToFollow);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set to sale the root endpoint cache hit
|
||||||
|
*/
|
||||||
|
invalidateRootCache() {
|
||||||
|
this.requestService.setStaleByHrefSubstring('server/api');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
/* tslint:enable:max-classes-per-file */
|
/* tslint:enable:max-classes-per-file */
|
||||||
|
@@ -32,6 +32,7 @@ export class ServerCheckGuard implements CanActivate {
|
|||||||
map((res: RemoteData<any>) => res.hasSucceeded),
|
map((res: RemoteData<any>) => res.hasSucceeded),
|
||||||
tap((hasSucceeded: boolean) => {
|
tap((hasSucceeded: boolean) => {
|
||||||
if (!hasSucceeded) {
|
if (!hasSucceeded) {
|
||||||
|
this.rootDataService.invalidateRootCache();
|
||||||
this.router.navigateByUrl(getPageInternalServerErrorRoute());
|
this.router.navigateByUrl(getPageInternalServerErrorRoute());
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
|
Reference in New Issue
Block a user