diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2017-07-19 00:50:05 +0200 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2017-07-19 00:50:05 +0200 |
| commit | 64e8c03dea044752bf3f2f228462721fe565f950 (patch) | |
| tree | 41b48b67f69979bfc97be166129ee41c8dcb0c7f /client/reducers/tasks.js | |
| parent | 11a70bc347587219b2ec7b63cf4a6ff69bb4199b (diff) | |
refactor all the worker stuff
Diffstat (limited to 'client/reducers/tasks.js')
| -rw-r--r-- | client/reducers/tasks.js | 13 |
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 } |
