blob: 470c7a72712c0dda9f2ba75cd93d66864cea1e7d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
// import { addTask } from '../actions'
import client from '../client'
const tasks = (state = [], action) => {
switch (action.type) {
case 'LOAD_TASKS':
return action.tasks
case 'ADD_TASK':
return [action.task].concat(state)
case 'TASK_UPDATED':
const updated_tasks = state.map(task => {
if (task.id == id) {
return task
}
return id
})
return updated_tasks
default:
return state
}
}
export default tasks
|