【发布时间】:2021-08-30 01:55:24
【问题描述】:
想知道是否有人可以帮助我了解这里发生了什么。
我正在运行一个调用 auth 服务的 ngrx 效果,对服务的调用正常工作,如果失败,它也会正确地进入 catch 错误。
问题是,如果它成功了,我想将原始操作传递给下一个操作员(而不是调用 auth 服务的响应)。
但是当我这样做时,我总是得到一个未定义的。
login$ = createEffect(
() =>
this.actions$.pipe(
ofType(AuthActions.login),
switchMap(action => {
return this.auth.login(action.user.email, action.password);
}),
map(action => { **// This is undefined, but what i want is the action object**
console.log(action);
this.store.dispatch(
loginSuccessful({
user: action,
})
);
}),
catchError((err) => {
console.log('Received error from AngularFire:', err);
return of(err);
})
),
{ dispatch: false }
);
【问题讨论】:
标签: angular rxjs firebase-authentication ngrx ngrx-effects