Created
October 11, 2017 10:03
-
-
Save nomanHasan/a780c75fe489267368d9cda269ee214a to your computer and use it in GitHub Desktop.
8 #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
// ........................ | |
export function TodoReducer(state = defaultState, action: Action) { | |
switch (action.type) { | |
//............... | |
case TodoActions.COMPLETE_TODO: { | |
return { | |
...state, | |
todos: state.todos.map(t => { | |
if (t._id == action.payload._id) { | |
t.status = "done"; | |
} | |
return t | |
}) | |
}; | |
} | |
default: { | |
return state; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment