Skip to content

Instantly share code, notes, and snippets.

@nomanHasan
Created October 11, 2017 09:59
Show Gist options
  • Save nomanHasan/30885bfe7aae97d862165167a44fbaf6 to your computer and use it in GitHub Desktop.
Save nomanHasan/30885bfe7aae97d862165167a44fbaf6 to your computer and use it in GitHub Desktop.
2 #todoapp-angular-ngrx
// ........................
export function TodoReducer(state = defaultState, action: Action) {
switch (action.type) {
case TodoActions.CREATE_TODO: {
return {
...state,
todos: state.todos.map(t => {
if (t._id == action.payload._id) {
t.loading = true;
}
return t
})
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment