diff options
Diffstat (limited to 'client/reducers/currentTask.js')
| -rw-r--r-- | client/reducers/currentTask.js | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/client/reducers/currentTask.js b/client/reducers/currentTask.js new file mode 100644 index 0000000..3f9233e --- /dev/null +++ b/client/reducers/currentTask.js @@ -0,0 +1,41 @@ +import { addTask } from '../actions' +import client from '../client' + +const currentTask = (state = {}, action) => { + console.log(action.type) + switch (action.type) { + case 'SET_CONTENT': + return { + ...state, + content: action.file + } + case 'SET_STYLE': + return { + ...state, + style: action.file + } + case 'SET_ALPHA': + return { + ...state, + alpha: action.alpha + } + case 'CREATE_TASK': + client.task.create( state ).then( (data) => { + addTask( data ) + }) + + return { + content: null, + style: null, + alpha: state.alpha, + } +// case 'ADD_TASK': +// return { +// ...state +// } + default: + return state + } +} + +export default currentTask
\ No newline at end of file |
