【发布时间】:2018-06-12 19:39:07
【问题描述】:
我试图在NgRX 6 中理解effects
我有一个示例效果:
@Effect()
createNonce$: Observable<Action> = this.actions$.pipe(
ofType(INVALID_SESSION),
map(() => generateNonce(32)),
map(nonce => of(this.store.dispatch(new IdentityRedirect(nonce)))),
catchError(error => of(console.error(error)))
);
我想要实现的是
- 收听
INVALID_SESSION - 调用
generateNonce并返回结果 - 派发上一张地图的结果
我收到以下错误
[ts]
Type 'Observable<void | Observable<void>>' is not assignable to type 'Observable<Action>'.
Type 'void | Observable<void>' is not assignable to type 'Action'.
Type 'void' is not assignable to type 'Action'.
【问题讨论】: