step 2.6 demo refinement

This commit is contained in:
Ken
2019-03-02 22:24:18 -08:00
parent 1f4baa2ca4
commit 562d3bc20d
15 changed files with 268 additions and 178 deletions

View File

@@ -14,10 +14,6 @@ export const todosReducer = createReducer<Store['todos']>(
},
clear(state, action) {
state[action.id].completed = !state[action.id].completed;
},
complete(state, action) {
Object.keys(state).forEach(key => {
if (state[key].completed) {
delete state[key];
@@ -25,6 +21,10 @@ export const todosReducer = createReducer<Store['todos']>(
});
},
complete(state, action) {
state[action.id].completed = !state[action.id].completed;
},
edit(state, action) {
state[action.id].label = action.label;
}