summaryrefslogtreecommitdiff
path: root/app/client/api
diff options
context:
space:
mode:
Diffstat (limited to 'app/client/api')
-rw-r--r--app/client/api/crud.types.js1
-rw-r--r--app/client/api/crud.upload.js19
-rw-r--r--app/client/api/util.js4
3 files changed, 19 insertions, 5 deletions
diff --git a/app/client/api/crud.types.js b/app/client/api/crud.types.js
index b7efdb8..630bf83 100644
--- a/app/client/api/crud.types.js
+++ b/app/client/api/crud.types.js
@@ -20,6 +20,7 @@ export const crud_type = (type, actions=[]) =>
'destroy_error',
'upload_loading',
'upload_progress',
+ 'upload_waiting',
'upload_complete',
'upload_error',
'sort',
diff --git a/app/client/api/crud.upload.js b/app/client/api/crud.upload.js
index 2e0269a..65ae4e0 100644
--- a/app/client/api/crud.upload.js
+++ b/app/client/api/crud.upload.js
@@ -24,11 +24,20 @@ export function crud_upload(type, fd, data, dispatch) {
function uploadProgress (e) {
if (e.lengthComputable) {
- dispatch && dispatch({
- type: as_type(type, 'upload_progress'),
- percent: Math.round(e.loaded * 100 / e.total) || 0,
- [type]: id,
- })
+ const percent = Math.round(e.loaded * 100 / e.total) || 0
+ if (percent > 99) {
+ dispatch && dispatch({
+ type: as_type(type, 'upload_waiting'),
+ percent,
+ [type]: id,
+ })
+ } else {
+ dispatch && dispatch({
+ type: as_type(type, 'upload_progress'),
+ percent,
+ [type]: id,
+ })
+ }
}
else {
dispatch && dispatch({
diff --git a/app/client/api/util.js b/app/client/api/util.js
index 99d63b4..e561ca4 100644
--- a/app/client/api/util.js
+++ b/app/client/api/util.js
@@ -9,3 +9,7 @@ htmlClassList.add(is_desktop ? 'desktop' : 'mobile')
htmlClassList.remove('loading')
// window.debug = false
+
+function randint(n) { return Math.floor(Math.random()*n) }
+
+document.body.style.background = 'linear-gradient(' + (randint(40)+40) + 'deg, #fde, #ffe)'