Finalized auth module

This commit is contained in:
Giuseppe Digilio
2018-02-22 15:47:15 +01:00
parent 4488a450c0
commit 2637f1c28e
12 changed files with 143 additions and 114 deletions

View File

@@ -1,11 +1,9 @@
import { Component, OnDestroy, OnInit } from '@angular/core';
import { Observable } from 'rxjs/Observable';
import { RouterReducerState } from '@ngrx/router-store';
import { Store } from '@ngrx/store';
import { fadeInOut, fadeOut } from '../animations/fade';
import { CoreState } from '../../core/core.reducers';
import { HostWindowService } from '../host-window.service';
import { AppState, routerStateSelector } from '../../app.reducer';
import { hasValue, isNotUndefined } from '../empty.util';
@@ -32,9 +30,8 @@ export class AuthNavMenuComponent implements OnDestroy, OnInit {
protected subs: Subscription[] = [];
constructor(
private store: Store<AppState>,
public windowService: HostWindowService) {
constructor(private store: Store<AppState>,
public windowService: HostWindowService) {
}
ngOnInit(): void {
@@ -44,7 +41,7 @@ export class AuthNavMenuComponent implements OnDestroy, OnInit {
this.user = this.store.select(getAuthenticatedUser);
this.subs.push(this.store.select(routerStateSelector)
.filter((router: RouterReducerState) => isNotUndefined(router))
.filter((router: RouterReducerState) => isNotUndefined(router) && isNotUndefined(router.state))
.subscribe((router: RouterReducerState) => {
this.showAuth = router.state.url !== '/login';
}));