summaryrefslogtreecommitdiff
path: root/app/client/dataset/upload.reducer.js
diff options
context:
space:
mode:
authorJules Laplace <julescarbon@gmail.com>2018-06-05 21:03:31 +0200
committerJules Laplace <julescarbon@gmail.com>2018-06-05 21:03:31 +0200
commit746c9f9399487ece15c369c4dd9e3388d415c22c (patch)
tree42341d940f3650ea77c85daabc24a15a44769d2b /app/client/dataset/upload.reducer.js
parent3b386480bfc8d0b2cc232fec62225d4b4c778c6b (diff)
separate dataset stuff from samplernn stuff
Diffstat (limited to 'app/client/dataset/upload.reducer.js')
-rw-r--r--app/client/dataset/upload.reducer.js52
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