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/dataset | |
| parent | dd31a7b9a3af167808b04ffe2af3a66af8b17c33 (diff) | |
async commands!!
Diffstat (limited to 'app/client/dataset')
| -rw-r--r-- | app/client/dataset/dataset.reducer.js | 110 |
1 files changed, 15 insertions, 95 deletions
diff --git a/app/client/dataset/dataset.reducer.js b/app/client/dataset/dataset.reducer.js index c7a2e26..801f768 100644 --- a/app/client/dataset/dataset.reducer.js +++ b/app/client/dataset/dataset.reducer.js @@ -7,116 +7,36 @@ const datasetInitialState = { } const datasetReducer = (state = datasetInitialState, action) => { - console.log(action) switch(action.type) { - case types.socket.connect: - return { - ...state, - } - case types.task.task_begin: - return { - ...state, - } - case types.task.task_finish: - 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.folder.upload_loading: return { - ...state, - upload: { - loading: true, - status: 'Loading...', - }, + error: null, + loading: true, + status: 'Loading...', } case types.folder.upload_error: return { - ...state, - upload: { - loading: false, - status: 'Error uploading :(', - }, + error: null, + loading: false, + status: 'Error uploading :(', } case types.folder.upload_progress: - console.log(action) return { - ...state, - upload: { - loading: true, - status: 'Upload progress ' + action.percent + '%', - }, + error: null, + loading: true, + status: 'Upload progress ' + action.percent + '%', } case types.folder.upload_waiting: - console.log(action) return { - ...state, - upload: { - loading: true, - status: 'Waiting for server to finish processing...', - }, + error: null, + loading: true, + 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: [action.files].concat(state.files), - upload: { - loading: false, - status: 'Upload complete', - }, - } - } else { - return { - ...state, - upload: { - loading: false, - status: 'Upload complete', - }, - } + error: null, + loading: true, + status: 'Creating file...' } case types.socket.status: return datasetSocket(state, action.data) |
