diff options
Diffstat (limited to 'client/reducers')
| -rw-r--r-- | client/reducers/audioPlayer.js | 20 | ||||
| -rw-r--r-- | client/reducers/currentTask.js | 16 | ||||
| -rw-r--r-- | client/reducers/index.js | 4 |
3 files changed, 32 insertions, 8 deletions
diff --git a/client/reducers/audioPlayer.js b/client/reducers/audioPlayer.js new file mode 100644 index 0000000..6ad4022 --- /dev/null +++ b/client/reducers/audioPlayer.js @@ -0,0 +1,20 @@ +import client from '../client' + +const audioPlayer = (state = {}, action) => { + switch (action.type) { + case 'AUDIO_PLAY_FILE': + return { + ...state, + file: action.file + } + case 'AUDIO_PAUSE': + return { + ...state, + paused: ! state.paused, + } + default: + return state + } +} + +export default audioPlayer
\ No newline at end of file diff --git a/client/reducers/currentTask.js b/client/reducers/currentTask.js index 3f9233e..e760fba 100644 --- a/client/reducers/currentTask.js +++ b/client/reducers/currentTask.js @@ -2,7 +2,6 @@ import { addTask } from '../actions' import client from '../client' const currentTask = (state = {}, action) => { - console.log(action.type) switch (action.type) { case 'SET_CONTENT': return { @@ -20,15 +19,18 @@ const currentTask = (state = {}, action) => { alpha: action.alpha } case 'CREATE_TASK': - client.task.create( state ).then( (data) => { + const record = { + content_file_id: state.content.id, + style_file_id: state.style.id, + alpha: state.alpha || '0.001', + command: 'nsatf.py', + completed: false, + } + client.task.create( record ).then( (data) => { addTask( data ) }) - return { - content: null, - style: null, - alpha: state.alpha, - } + return state // case 'ADD_TASK': // return { // ...state diff --git a/client/reducers/index.js b/client/reducers/index.js index ed59b60..0dee19c 100644 --- a/client/reducers/index.js +++ b/client/reducers/index.js @@ -1,9 +1,11 @@ import { combineReducers } from 'redux' import currentTask from './currentTask' +import audioPlayer from './audioPlayer' const cortexApp = combineReducers({ - currentTask + currentTask, + audioPlayer, }) export default cortexApp |
