[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:
Giuseppe Digilio
2021-12-14 12:42:24 +01:00
parent b6904a4df9
commit ddcb1ecdf2
2 changed files with 8 additions and 0 deletions

View File

@@ -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>>> {
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 */

View File

@@ -32,6 +32,7 @@ export class ServerCheckGuard implements CanActivate {
map((res: RemoteData<any>) => res.hasSucceeded),
tap((hasSucceeded: boolean) => {
if (!hasSucceeded) {
this.rootDataService.invalidateRootCache();
this.router.navigateByUrl(getPageInternalServerErrorRoute());
}
}),