Files
dspace-angular/src/app/header/header.effects.ts
2018-08-29 15:12:01 +02:00

29 lines
704 B
TypeScript

import { map } from 'rxjs/operators';
import { Injectable } from '@angular/core';
import { Effect, Actions, ofType } from '@ngrx/effects'
import * as fromRouter from '@ngrx/router-store';
import { HostWindowActionTypes } from '../shared/host-window.actions';
import { HeaderCollapseAction } from './header.actions';
@Injectable()
export class HeaderEffects {
@Effect() resize$ = this.actions$
.pipe(
ofType(HostWindowActionTypes.RESIZE),
map(() => new HeaderCollapseAction())
);
@Effect() routeChange$ = this.actions$
.pipe(
ofType(fromRouter.ROUTER_NAVIGATION),
map(() => new HeaderCollapseAction())
);
constructor(private actions$: Actions) {
}
}