diff options
Diffstat (limited to 'app/client/dataset/upload.reducer.js')
| -rw-r--r-- | app/client/dataset/upload.reducer.js | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/app/client/dataset/upload.reducer.js b/app/client/dataset/upload.reducer.js new file mode 100644 index 0000000..e28a18e --- /dev/null +++ b/app/client/dataset/upload.reducer.js @@ -0,0 +1,52 @@ +import types from '../types' + +const uploadInitialState = { + loading: false, + error: null, + status: '', +} + +const uploadReducer = (state = uploadInitialState, action) => { + switch(action.type) { + case types.folder.upload_loading: + return { + error: null, + loading: true, + status: 'Loading...', + } + case types.folder.upload_error: + return { + error: null, + loading: false, + status: 'Error uploading :(', + } + case types.folder.upload_progress: + return { + error: null, + loading: true, + status: 'Upload progress ' + action.percent + '%', + } + case types.folder.upload_waiting: + return { + error: null, + loading: true, + status: 'Waiting for server to finish processing...', + } + case types.folder.upload_complete: + return { + error: null, + loading: false, + status: 'Upload complete', + } + case types.file.create_loading: + return { + error: null, + loading: true, + status: 'Creating file...' + } + default: + return state + } +} + +export default uploadReducer |
