blob: c5f2c06e53b1284a19ef6117b97779ddc481cd01 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
// 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
|