Last active
February 25, 2018 17:46
-
-
Save paullessing/1c70cf3eacc540f1acee0ff91e1b1f70 to your computer and use it in GitHub Desktop.
Handling Errors in NgRx Effects - Snippet 2 (TodoEffects without Error Handling)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Injectable() | |
export class TodoEffects { | |
@Effect() | |
public fetchListOfTodos$: Observable<void> = this.action$.pipe( | |
ofType(ActionTypes.FETCH_TODO_LIST), | |
switchMap(() => this.todoListService.fetchTodoList()), | |
map((todos: Todo[]) => { | |
return { | |
type: ActionTypes.TODO_LIST_FETCHED, | |
payload: { todos } | |
}; | |
}) | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment