Created
February 19, 2019 05:58
-
-
Save lydemann/8bdee9dca899f224cd89ee03faea0e1e to your computer and use it in GitHub Desktop.
todo-list.effects.ts
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 TodoListEffects { | |
constructor(private actions$: Actions, private todoListService: TodoListService) {} | |
@Effect() | |
loadTodoList$ = this.actions$.pipe( | |
ofType(TodoListActionTypes.LoadTodoList), | |
exhaustMap(() => this.todoListService.getTodos()), | |
map((todoList) => new TodoItemsLoaded(todoList)), | |
catchError((error: Error) => of(new TodoItemsLoadFailed(error))) | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment