summaryrefslogtreecommitdiff
path: root/app/client/api
diff options
context:
space:
mode:
authorJules Laplace <julescarbon@gmail.com>2018-05-29 18:51:27 +0200
committerJules Laplace <julescarbon@gmail.com>2018-05-29 18:51:27 +0200
commitfe8cef1b709f09f508f17d0d6d06f204dd44a8bb (patch)
tree75c03c0734106dda0a4e5b407778b58ec758d029 /app/client/api
parent7d71a0248a8746088142bb51ce4248c76f274f30 (diff)
pushing files to s3.. filelist color
Diffstat (limited to 'app/client/api')
-rw-r--r--app/client/api/crud.upload.js4
-rw-r--r--app/client/api/index.js1
-rw-r--r--app/client/api/util.js11
3 files changed, 15 insertions, 1 deletions
diff --git a/app/client/api/crud.upload.js b/app/client/api/crud.upload.js
index 97b6769..2e0269a 100644
--- a/app/client/api/crud.upload.js
+++ b/app/client/api/crud.upload.js
@@ -20,11 +20,13 @@ export function crud_upload(type, fd, data, dispatch) {
dispatch && dispatch({ type: as_type(type, 'upload_loading')})
+ let complete = false
+
function uploadProgress (e) {
if (e.lengthComputable) {
dispatch && dispatch({
type: as_type(type, 'upload_progress'),
- percent: Math.round(e.loaded * 100 / e.total),
+ percent: Math.round(e.loaded * 100 / e.total) || 0,
[type]: id,
})
}
diff --git a/app/client/api/index.js b/app/client/api/index.js
index 82cd364..a0cae50 100644
--- a/app/client/api/index.js
+++ b/app/client/api/index.js
@@ -1,4 +1,5 @@
import { crud_actions } from './crud.actions'
+import * as util from './util'
/*
for our crud events, create corresponding actions
diff --git a/app/client/api/util.js b/app/client/api/util.js
new file mode 100644
index 0000000..99d63b4
--- /dev/null
+++ b/app/client/api/util.js
@@ -0,0 +1,11 @@
+export const is_iphone = !!((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i)))
+export const is_ipad = !!(navigator.userAgent.match(/iPad/i))
+export const is_android = !!(navigator.userAgent.match(/Android/i))
+export const is_mobile = is_iphone || is_ipad || is_android
+export const is_desktop = ! is_mobile;
+
+const htmlClassList = document.body.parentNode.classList
+htmlClassList.add(is_desktop ? 'desktop' : 'mobile')
+htmlClassList.remove('loading')
+
+// window.debug = false