mirror of
https://github.com/microsoft/frontend-bootcamp.git
synced 2026-01-26 14:56:42 +08:00
step 2.6 demo refinement
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user