diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2018-06-01 03:30:39 +0200 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2018-06-01 03:30:39 +0200 |
| commit | 964ac7009e6db5a06233bdc07fa63778eebf2db7 (patch) | |
| tree | 960ceb019514f960a6597b9b282baf4d5cd77607 /app/client/modules/samplernn/samplernn.reducer.js | |
| parent | dd31a7b9a3af167808b04ffe2af3a66af8b17c33 (diff) | |
async commands!!
Diffstat (limited to 'app/client/modules/samplernn/samplernn.reducer.js')
| -rw-r--r-- | app/client/modules/samplernn/samplernn.reducer.js | 48 |
1 files changed, 46 insertions, 2 deletions
diff --git a/app/client/modules/samplernn/samplernn.reducer.js b/app/client/modules/samplernn/samplernn.reducer.js index b3b58c3..9ecd492 100644 --- a/app/client/modules/samplernn/samplernn.reducer.js +++ b/app/client/modules/samplernn/samplernn.reducer.js @@ -3,6 +3,7 @@ import types from '../../types' const samplernnInitialState = { loading: false, error: null, + folder: {}, folders: [], datasets: [], results: [], @@ -17,8 +18,11 @@ const samplernnInitialState = { } const samplernnReducer = (state = samplernnInitialState, action) => { - console.log(action) switch(action.type) { + case types.socket.connect: + return { + ...state, + } case types.task.task_begin: return { ...state, @@ -27,7 +31,45 @@ const samplernnReducer = (state = samplernnInitialState, action) => { return { ...state, } + case types.folder.index: + return { + ...state, + folders: action.data, + folder: action.data[0], + } + case types.folder.update: + return state + + case types.file.index: + return { + ...state, + files: action.data + } + case types.file.create: + if (state.folder.id === action.data.folder_id) { + return { + ...state, + files: [action.data].concat(state.files), + } + } + return state + + case types.folder.upload_complete: + if (state.folder.id === action.folder) { + return { + ...state, + files: [action.files].concat(state.files), + } + } + return state + + case types.system.list_directory: + console.log('list directory', action.data) + return { + ...state, + } + case types.socket.status: return samplernnSocket(state, action.data) default: @@ -38,7 +80,9 @@ const samplernnReducer = (state = samplernnInitialState, action) => { const samplernnSocket = (state, action) => { console.log(action) switch (action.key) { - default: + case 'list_directory': + return state + default: return state } } |
