diff options
Diffstat (limited to 'app/client/modules/samplernn/samplernn.reducer.js')
| -rw-r--r-- | app/client/modules/samplernn/samplernn.reducer.js | 47 |
1 files changed, 34 insertions, 13 deletions
diff --git a/app/client/modules/samplernn/samplernn.reducer.js b/app/client/modules/samplernn/samplernn.reducer.js index ba429ee..efd31f5 100644 --- a/app/client/modules/samplernn/samplernn.reducer.js +++ b/app/client/modules/samplernn/samplernn.reducer.js @@ -8,8 +8,8 @@ const samplernnInitialState = { files: [], results: [], upload: { - loading: true, - status: 'Loading...', + loading: false, + status: '', }, } @@ -28,29 +28,21 @@ const samplernnReducer = (state = samplernnInitialState, action) => { return { ...state, } + case types.folder.index: - console.log(action) return { ...state, folders: action.data, folder: action.data[0], } case types.folder.update: - console.log(action) return state case types.file.index: - console.log(action) return { ...state, files: action.data } - case types.file.create: - console.log(action) - return { - ...state, - files: [action.data].concat(this.files) - } - return + case types.folder.upload_loading: return { ...state, @@ -85,14 +77,43 @@ const samplernnReducer = (state = samplernnInitialState, action) => { status: 'Waiting for server to finish processing...', }, } + case types.file.create_loading: + return { + ...state, + upload: { + loading: true, + status: 'Creating file...' + } + } + case types.file.create: + console.log('booo') + if (state.folder.id === action.data.folder_id) { + return { + ...state, + files: [action.data].concat(state.files), + upload: { + loading: false, + status: 'File created', + }, + } + } else { + return { + ...state, + upload: { + loading: false, + status: 'created', + }, + } + } case types.folder.upload_complete: console.log(action) if (state.folder.id === action.folder) { return { ...state, - files: state.files.concat(state.file), // sort here also + files: [action.files].concat(state.files), upload: { loading: false, + status: 'Upload complete', }, } } else { |
