intermediate commit

This commit is contained in:
lotte
2018-08-29 15:12:01 +02:00
parent 2cbe6a6d91
commit 777facf5cd
91 changed files with 1150 additions and 964 deletions

View File

@@ -1,13 +1,19 @@
import { of as observableOf, Observable } from 'rxjs';
import { map, filter } from 'rxjs/operators';
import { Component, OnInit } from '@angular/core';
import { Observable } from 'rxjs';
import { RouterReducerState } from '@ngrx/router-store';
import { Store } from '@ngrx/store';
import { select, Store } from '@ngrx/store';
import { fadeInOut, fadeOut } from '../animations/fade';
import { HostWindowService } from '../host-window.service';
import { AppState, routerStateSelector } from '../../app.reducer';
import { isNotUndefined } from '../empty.util';
import { getAuthenticatedUser, isAuthenticated, isAuthenticationLoading } from '../../core/auth/selectors';
import {
getAuthenticatedUser,
isAuthenticated,
isAuthenticationLoading
} from '../../core/auth/selectors';
import { Eperson } from '../../core/eperson/models/eperson.model';
import { LOGIN_ROUTE, LOGOUT_ROUTE } from '../../core/auth/auth.service';
@@ -32,7 +38,7 @@ export class AuthNavMenuComponent implements OnInit {
public isXsOrSm$: Observable<boolean>;
public showAuth = Observable.of(false);
public showAuth = observableOf(false);
public user: Observable<Eperson>;
@@ -43,17 +49,19 @@ export class AuthNavMenuComponent implements OnInit {
ngOnInit(): void {
// set isAuthenticated
this.isAuthenticated = this.store.select(isAuthenticated);
this.isAuthenticated = this.store.pipe(select(isAuthenticated));
// set loading
this.loading = this.store.select(isAuthenticationLoading);
this.loading = this.store.pipe(select(isAuthenticationLoading));
this.user = this.store.select(getAuthenticatedUser);
this.user = this.store.pipe(select(getAuthenticatedUser));
this.showAuth = this.store.select(routerStateSelector)
.filter((router: RouterReducerState) => isNotUndefined(router) && isNotUndefined(router.state))
.map((router: RouterReducerState) => {
this.showAuth = this.store.pipe(
select(routerStateSelector),
filter((router: RouterReducerState) => isNotUndefined(router) && isNotUndefined(router.state)),
map((router: RouterReducerState) => {
return !router.state.url.startsWith(LOGIN_ROUTE) && !router.state.url.startsWith(LOGOUT_ROUTE);
});
})
);
}
}