NetanelBasal
2/23/2017 - 5:59 AM

effect5.ts

    switchMap(action =>
      this.todosService.getTodos()
           // If successful, dispatch success action with result
           .map(todos => ({type: GET_TODOS_SUCCESS, payload: todos}))
           // If request fails, dispatch failed action
           .catch(() => Observable.of({type: GET_TODOS_ERROR})));