in my application, I tracking for session time
@Effect()
session$: Observable<Action> = this.actions$
.ofType(authAction.RESET_SESSION)
.switchMap(_ => Observable.of({ type: authAction.LOGOUT })
.delay(600000);
*every time that RESET_SESSION
action is called, the logout action waits 10 minutes.
in my application, I get session time from the server and store it on state after login. how I can use this store value in delay? ( because in ngrx store return observable and not object of state)
something like this:
@Effect()
session$: Observable<Action> = this.actions$
.ofType(authAction.RESET_SESSION)
.switchMap(_ => Observable.of({ type: authAction.LOGOUT })
.delay(this.store.pluck('auth','sessionTime'));
You would need to inject the store into the Effects through the constructor. Something like: