ngrx effect()只触发一次 - Angular 4

时间:2017-08-07 22:36:30

标签: angular ngrx ngrx-store ngrx-effects

我的登录系统是围绕ngrx / store构建的。当我加载网站时,它第一次提交登录凭据时效果很好。但是,一旦我做了两次(比如我输错了密码),事件就会被触发,但效果却没有。我无法弄清楚问题是什么。

有问题的@Effext():

@Effect() loginUser$: Observable<any> = this.action
    .ofType(LOGIN)
    .map(toPayload)
    .flatMap(payload => this.http.post('http://localhost:3000/api/auth/login', payload))
    .map(data => ({type: LOGIN_SUCCESS, payload: data.json()}))
    .catch(error => of({type: LOGIN_FAILED, payload: error}))

以这种方式构建的所有效果都是一样的。

enter image description here

0 个答案:

没有答案