mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 10:04:11 +00:00
Updated browser init to update cache after external auth.
This commit is contained in:

committed by
Tim Donohue

parent
36f07604ae
commit
98d9f639f7
@@ -30,9 +30,11 @@ import { filter, find, map } from 'rxjs/operators';
|
|||||||
import { isNotEmpty } from '../../app/shared/empty.util';
|
import { isNotEmpty } from '../../app/shared/empty.util';
|
||||||
import { logStartupMessage } from '../../../startup-message';
|
import { logStartupMessage } from '../../../startup-message';
|
||||||
import { MenuService } from '../../app/shared/menu/menu.service';
|
import { MenuService } from '../../app/shared/menu/menu.service';
|
||||||
|
import { RequestService } from '../../app/core/data/request.service';
|
||||||
import { RootDataService } from '../../app/core/data/root-data.service';
|
import { RootDataService } from '../../app/core/data/root-data.service';
|
||||||
import { firstValueFrom, Subscription } from 'rxjs';
|
import { firstValueFrom, Subscription } from 'rxjs';
|
||||||
import { ServerCheckGuard } from '../../app/core/server-check/server-check.guard';
|
import { ServerCheckGuard } from '../../app/core/server-check/server-check.guard';
|
||||||
|
import { HALEndpointService } from '../../app/core/shared/hal-endpoint.service';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Performs client-side initialization.
|
* Performs client-side initialization.
|
||||||
@@ -59,6 +61,8 @@ export class BrowserInitService extends InitService {
|
|||||||
protected menuService: MenuService,
|
protected menuService: MenuService,
|
||||||
private rootDataService: RootDataService,
|
private rootDataService: RootDataService,
|
||||||
protected serverCheckGuard: ServerCheckGuard,
|
protected serverCheckGuard: ServerCheckGuard,
|
||||||
|
private requestService: RequestService,
|
||||||
|
private halService: HALEndpointService,
|
||||||
) {
|
) {
|
||||||
super(
|
super(
|
||||||
store,
|
store,
|
||||||
@@ -145,17 +149,15 @@ export class BrowserInitService extends InitService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* During an external authentication flow invalidate the SSR transferState
|
* During an external authentication flow invalidate the
|
||||||
* data in the cache. This allows the app to fetch fresh content.
|
* data in the cache. This allows the app to fetch fresh content.
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
private externalAuthCheck() {
|
private externalAuthCheck() {
|
||||||
|
|
||||||
this.sub = this.authService.isExternalAuthentication().pipe(
|
this.sub = this.authService.isExternalAuthentication().pipe(
|
||||||
filter((externalAuth: boolean) => externalAuth)
|
filter((externalAuth: boolean) => externalAuth)
|
||||||
).subscribe(() => {
|
).subscribe(() => {
|
||||||
// Clear the transferState data.
|
this.requestService.setStaleByHrefSubstring(this.halService.getRootHref());
|
||||||
this.rootDataService.invalidateRootCache();
|
|
||||||
this.authService.setExternalAuthStatus(false);
|
this.authService.setExternalAuthStatus(false);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
Reference in New Issue
Block a user