mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-15 22:13:02 +00:00
92900: Move duplicate code to new InitService method
This commit is contained in:
@@ -20,6 +20,9 @@ import { Angulartics2DSpace } from './statistics/angulartics/dspace-provider';
|
||||
import { MetadataService } from './core/metadata/metadata.service';
|
||||
import { BreadcrumbsService } from './breadcrumbs/breadcrumbs.service';
|
||||
import { ThemeService } from './shared/theme-support/theme.service';
|
||||
import { isAuthenticationBlocking } from './core/auth/selectors';
|
||||
import { distinctUntilChanged, find } from 'rxjs/operators';
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
/**
|
||||
* Performs the initialization of the app.
|
||||
@@ -186,4 +189,16 @@ export abstract class InitService {
|
||||
this.breadcrumbsService.listenForRouteChanges();
|
||||
this.themeService.listenForRouteChanges();
|
||||
}
|
||||
|
||||
/**
|
||||
* Emits once authentication is ready (no longer blocking)
|
||||
* @protected
|
||||
*/
|
||||
protected authenticationReady$(): Observable<boolean> {
|
||||
return this.store.pipe(
|
||||
select(isAuthenticationBlocking),
|
||||
distinctUntilChanged(),
|
||||
find((b: boolean) => b === false)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user