diff options
Diffstat (limited to 'client/reducers')
| -rw-r--r-- | client/reducers/currentTask.js | 41 | ||||
| -rw-r--r-- | client/reducers/index.js | 9 |
2 files changed, 50 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 diff --git a/client/reducers/index.js b/client/reducers/index.js new file mode 100644 index 0000000..ed59b60 --- /dev/null +++ b/client/reducers/index.js @@ -0,0 +1,9 @@ +import { combineReducers } from 'redux' + +import currentTask from './currentTask' + +const cortexApp = combineReducers({ + currentTask +}) + +export default cortexApp |
