summaryrefslogtreecommitdiff
path: root/client/reducers/tasks.js
diff options
context:
space:
mode:
Diffstat (limited to 'client/reducers/tasks.js')
-rw-r--r--client/reducers/tasks.js13
1 files changed, 12 insertions, 1 deletions
diff --git a/client/reducers/tasks.js b/client/reducers/tasks.js
index d6ef8e1..9edd82a 100644
--- a/client/reducers/tasks.js
+++ b/client/reducers/tasks.js
@@ -1,10 +1,21 @@
// import { addTask } from '../actions'
import client from '../client'
-const tasks = (state = {}, action) => {
+const tasks = (state = [], action) => {
switch (action.type) {
case 'LOAD_TASKS':
return action.tasks
+ case 'ADD_TASK':
+ console.log(action)
+ return state.concat([action.task])
+ case 'TASK_UPDATED':
+ const updated_tasks = state.map(task => {
+ if (task.id == id) {
+ return task
+ }
+ return id
+ })
+ return updated_tasks
default:
return state
}