Ngrx效果具有多个动作

时间:2018-07-11 12:42:07

标签: ngrx ngrx-effects

如何在http请求之前添加操作?我想在请求之前运行TEST_INC ...,然后在http请求之后运行TEST_DEC

 @Effect()
 acadDomain$: Observable<Action> = this.actions$.pipe(
  ofType('INIT_ACADEMY_DOMAIN'),
  // I want here to apply action "TEST_INC"
  mergeMap((action: any) =>
     this.http.get('https://DOMAIN/settings.json').pipe(
        switchMap((data) => [
           { type: 'INIT_ACADEMY', payload: data },
           { type: 'TEST_DEC' }
        ])
     )
  )
);

仅供参考:(rxjs 6)

0 个答案:

没有答案