mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-15 05:53:03 +00:00
Merge branch 'master' into resolvers-branch-angular6
Conflicts: package.json src/app/+search-page/search-filters/search-filters.component.ts src/app/core/auth/auth.effects.ts src/app/core/auth/auth.service.ts src/app/core/auth/server-auth.service.ts src/app/core/data/comcol-data.service.ts src/app/core/data/community-data.service.ts src/app/core/data/data.service.ts src/app/core/data/item-data.service.ts src/app/core/shared/dspace-object.model.ts src/app/header/header.component.spec.ts src/app/shared/auth-nav-menu/auth-nav-menu.component.ts src/app/shared/testing/auth-service-stub.ts yarn.lock
This commit is contained in:
@@ -14,8 +14,9 @@ import {
|
||||
isAuthenticated,
|
||||
isAuthenticationLoading
|
||||
} from '../../core/auth/selectors';
|
||||
import { Eperson } from '../../core/eperson/models/eperson.model';
|
||||
import { LOGIN_ROUTE, LOGOUT_ROUTE } from '../../core/auth/auth.service';
|
||||
import { EPerson } from '../../core/eperson/models/eperson.model';
|
||||
import { AuthService, LOGIN_ROUTE, LOGOUT_ROUTE } from '../../core/auth/auth.service';
|
||||
import { Subscription } from 'rxjs/Subscription';
|
||||
|
||||
@Component({
|
||||
selector: 'ds-auth-nav-menu',
|
||||
@@ -40,10 +41,14 @@ export class AuthNavMenuComponent implements OnInit {
|
||||
|
||||
public showAuth = observableOf(false);
|
||||
|
||||
public user: Observable<Eperson>;
|
||||
public user: Observable<EPerson>;
|
||||
|
||||
public sub: Subscription;
|
||||
|
||||
constructor(private store: Store<AppState>,
|
||||
private windowService: HostWindowService) {
|
||||
private windowService: HostWindowService,
|
||||
private authService: AuthService
|
||||
) {
|
||||
this.isXsOrSm$ = this.windowService.isXsOrSm();
|
||||
}
|
||||
|
||||
@@ -56,12 +61,15 @@ export class AuthNavMenuComponent implements OnInit {
|
||||
|
||||
this.user = this.store.pipe(select(getAuthenticatedUser));
|
||||
|
||||
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);
|
||||
})
|
||||
);
|
||||
this.showAuth = this.store.select(routerStateSelector)
|
||||
.filter((router: RouterReducerState) => isNotUndefined(router) && isNotUndefined(router.state))
|
||||
.map((router: RouterReducerState) => {
|
||||
const url = router.state.url;
|
||||
const show = !router.state.url.startsWith(LOGIN_ROUTE) && !router.state.url.startsWith(LOGOUT_ROUTE);
|
||||
if (show) {
|
||||
this.authService.setRedirectUrl(url);
|
||||
}
|
||||
return show;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user