Created
October 11, 2017 09:54
-
-
Save nomanHasan/fc430aaf46d754b9e0832b5142453572 to your computer and use it in GitHub Desktop.
2 #todoapp-angular-ngrx
This file contains hidden or 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
//.............................. | |
@Effect() | |
GetTodos$: Observable<Action> = this.actions$. | |
ofType<TodoActions.GetTodos>(TodoActions.GET_TODOS) | |
.mergeMap(action => | |
this.http.get(environment.client.base_url + '/api/todos') | |
.map((data: Response) => { | |
console.log(data); | |
return new TodoActions.GetTodosSuccess(data["data"]["docs"] as TodoState[]); | |
}) | |
.catch(() => of(new TodoActions.GetTodoError())) | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment