Does anyone know why the switchMap
operator is not working ?
I have tried to put second map
operator instead and it worked but I am not getting why switchMap
is not working.
@Injectable()
export class PizzasEffects {
constructor(private actions: Actions, private pizzasService: PizzasService) {}
@Effect()
createPizzaSuccess$ = this.actions.ofType( fromPizzasActions.CREATE_PIZZA_SUCCESS ).pipe(
map( (action: fromPizzasActions.CreatePizzaSuccess) => action.payload ),
switchMap( (pizza: Pizza) => new fromRouterActions.Go({path: ['products', pizza.id]}) )
);
}