Created
October 11, 2017 09:55
-
-
Save nomanHasan/6cd373a38fab1acc39b1fb3c53ec20ab to your computer and use it in GitHub Desktop.
4 #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() | |
deleteTodo$: Observable<Action> = this.actions$. | |
ofType<TodoActions.DeleteTodo>(TodoActions.DELETE_TODO) | |
.mergeMap(action => | |
this.http.delete(environment.client.base_url + '/api/todos/' + action.payload._id) | |
.map((data: Response) => { | |
return new TodoActions.DeleteTodoSuccess({ | |
...action.payload, loading: 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