mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 10:04:11 +00:00
fixed auth module
This commit is contained in:
@@ -17,6 +17,9 @@ import { MetadataService } from './core/metadata/metadata.service';
|
||||
import { HostWindowResizeAction } from './shared/host-window.actions';
|
||||
import { HostWindowState } from './shared/host-window.reducer';
|
||||
import { NativeWindowRef, NativeWindowService } from './shared/services/window.service';
|
||||
import { CheckAuthenticationTokenAction } from './core/auth/auth.actions';
|
||||
import { isAuthenticated } from './core/auth/selectors';
|
||||
import { PlatformService } from './shared/services/platform.service';
|
||||
|
||||
@Component({
|
||||
selector: 'ds-app',
|
||||
@@ -32,7 +35,8 @@ export class AppComponent implements OnInit {
|
||||
@Inject(NativeWindowService) private _window: NativeWindowRef,
|
||||
private translate: TranslateService,
|
||||
private store: Store<HostWindowState>,
|
||||
private metadata: MetadataService
|
||||
private metadata: MetadataService,
|
||||
private platformService: PlatformService
|
||||
) {
|
||||
// this language will be used as a fallback when a translation isn't found in the current language
|
||||
translate.setDefaultLang('en');
|
||||
@@ -51,6 +55,12 @@ export class AppComponent implements OnInit {
|
||||
const color: string = this.config.production ? 'red' : 'green';
|
||||
console.info(`Environment: %c${env}`, `color: ${color}; font-weight: bold;`);
|
||||
this.dispatchWindowSize(this._window.nativeWindow.innerWidth, this._window.nativeWindow.innerHeight);
|
||||
if (this.platformService.isServer) {
|
||||
this.store.select(isAuthenticated)
|
||||
.take(1)
|
||||
.filter((authenticated) => !authenticated)
|
||||
.subscribe((authenticated) => this.store.dispatch(new CheckAuthenticationTokenAction()));
|
||||
}
|
||||
}
|
||||
|
||||
@HostListener('window:resize', ['$event'])
|
||||
|
Reference in New Issue
Block a user