step 6 exercise

This commit is contained in:
Ken
2019-02-19 22:20:09 -08:00
parent 2b41788cc2
commit 72ace4f43c
12 changed files with 39 additions and 159 deletions

View File

@@ -1,19 +1,15 @@
import { Store } from '../store';
import { addTodo, remove, complete, clear } from './pureFunctions';
import { addTodo, remove, complete } from './pureFunctions';
export function reducer(state: Store['todos'], payload: any): Store['todos'] {
switch (payload.type) {
case 'addTodo':
return addTodo(state, payload.id, payload.label);
case 'remove':
return remove(state, payload.id);
case 'complete':
return complete(state, payload.id);
case 'clear':
return clear(state);
// Fill in the blanks here for:
// - remove
// - complete
// - clear
}
return state;