1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

NgRx: dispatch multiple actions in a single effect

Discussão em 'Angular' iniciado por Rashed Bayani, Setembro 17, 2024.

  1. I need to dispatch multiple actions after calling an API request in my effect. I'm using this code at the moment to dispatch one action after API request done:

    changeStatus$ = createEffect(() =>
    this.actions$.pipe(
    ofType(fromJtDetail.changeStatus),
    switchMap(action =>
    this.jtDetailService.changeStatus(action.entity,action.jobTicketId).pipe(
    map(res => fromJtDetail.statusChanged({changedStatus: action.entity.newStatus})),
    catchError(error => EMPTY)
    ))));


    It's important to dispatch more actions in this effect, can't write another effect for this.

    Continue reading...

Compartilhe esta Página