diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2017-07-19 02:27:52 +0200 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2017-07-19 02:27:52 +0200 |
| commit | 9c5b96aec109f7b37cb2c861525a084a65a817ea (patch) | |
| tree | 3aa2f97b5134892a9f227c6c8fdc8cd778679771 /client/reducers | |
| parent | 2f2c1ef4029dee17be0d16acdd60b7d1718d519f (diff) | |
adding tasks
Diffstat (limited to 'client/reducers')
| -rw-r--r-- | client/reducers/currentTask.js | 8 | ||||
| -rw-r--r-- | client/reducers/tasks.js | 3 |
2 files changed, 5 insertions, 6 deletions
diff --git a/client/reducers/currentTask.js b/client/reducers/currentTask.js index 126c35d..5f5fe52 100644 --- a/client/reducers/currentTask.js +++ b/client/reducers/currentTask.js @@ -26,10 +26,10 @@ const currentTask = (state = {}, action) => { tool: 'nsatf', completed: false, } - client.task.create( record ).then( (data) => { - data.content_file = state.content - data.style_file = state.file - // store.dispatch( addTask( data ) ) + client.task.create( record ).then( (task) => { + task.content_file = state.content + task.style_file = state.file + action.cb && action.cb(task) }) return state default: diff --git a/client/reducers/tasks.js b/client/reducers/tasks.js index 9edd82a..470c7a7 100644 --- a/client/reducers/tasks.js +++ b/client/reducers/tasks.js @@ -6,8 +6,7 @@ const tasks = (state = [], action) => { case 'LOAD_TASKS': return action.tasks case 'ADD_TASK': - console.log(action) - return state.concat([action.task]) + return [action.task].concat(state) case 'TASK_UPDATED': const updated_tasks = state.map(task => { if (task.id == id) { |
