mirror of
https://github.com/microsoft/frontend-bootcamp.git
synced 2026-07-13 15:28:32 +08:00
17 lines
386 B
TypeScript
17 lines
386 B
TypeScript
import { Store } from '../store';
|
|
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);
|
|
|
|
// Fill in the blanks here for:
|
|
// - remove
|
|
// - complete
|
|
// - clear
|
|
}
|
|
|
|
return state;
|
|
}
|