Created
October 11, 2017 09:55
-
-
Save nomanHasan/cf181d3ca7b7739d0292221d1fb137ac to your computer and use it in GitHub Desktop.
5 #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() | |
updateTodo$: Observable<Action> = this.actions$. | |
ofType<TodoActions.UpdateTodo>(TodoActions.UPDATE_TODO) | |
.mergeMap(action => | |
this.http.put(environment.client.base_url + '/api/todos/', action.payload) | |
.map((data: Response) => { | |
return new TodoActions.UpdateTodoSuccess({ | |
...action.payload, loading: false, editing: false | |
}); | |
}) | |
.catch(() => of(new TodoActions.DeleteTodoError(action.payload))) | |
); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment