Created
December 24, 2019 13:54
-
-
Save lydemann/d3475ea7378f1e784577cf28a67b1091 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 { | |
public getTodoListRequest$ = createEffect(() => | |
this.actions$.pipe( | |
ofType(TodoListActions.getTodoListRequest), | |
exhaustMap(() => | |
this.todoListResourcesService.getTodos().pipe( | |
map(todoList => TodoListActions.getTodoListResponse({ todoList })), | |
catchError((error: Error) => | |
of(TodoListActions.getTodoListFailed({ error })), | |
), | |
), | |
), | |
), | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment