aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/upload.js
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2024-08-30 18:52:00 -0700
committerAdam Soltys <[email protected]>2024-08-30 18:52:00 -0700
commit8f01af248c67766a3bf07ef628268f4c3ec7f22e (patch)
tree0f5efabd144b720598441d9a638fd27d849628ff /src/lib/upload.js
parent7ca70dcbab180f1c30e57b2d1892e5ccce172e2d (diff)
downloadcoinos-ui-8f01af248c67766a3bf07ef628268f4c3ec7f22e.tar.gz
coinos-ui-8f01af248c67766a3bf07ef628268f4c3ec7f22e.zip
typescript
Diffstat (limited to 'src/lib/upload.js')
-rw-r--r--src/lib/upload.js18
1 files changed, 0 insertions, 18 deletions
diff --git a/src/lib/upload.js b/src/lib/upload.js
deleted file mode 100644
index 31c235c6..00000000
--- a/src/lib/upload.js
+++ /dev/null
@@ -1,18 +0,0 @@
-export const upload = async (file, type, progress) => {
- let url = `/api/upload/${type}`;
- let formData = new FormData();
- formData.append("file", file);
-
- return new Promise((resolve, reject) => {
- let ajax = new XMLHttpRequest();
- ajax.addEventListener("load", () => {
- if (ajax.readyState === ajax.DONE) {
- if (ajax.status === 200) resolve(ajax.response);
- else reject(new Error(`Upload failed: ${ajax.response}`));
- }
- });
- ajax.upload.addEventListener("progress", progress, false);
- ajax.open("POST", url);
- ajax.send(formData);
- });
-};