summaryrefslogtreecommitdiff
path: root/iridescence/src
diff options
context:
space:
mode:
Diffstat (limited to 'iridescence/src')
-rw-r--r--iridescence/src/api/dichroism.js12
-rw-r--r--iridescence/src/components/admin/ProductEditCard.vue25
2 files changed, 13 insertions, 24 deletions
diff --git a/iridescence/src/api/dichroism.js b/iridescence/src/api/dichroism.js
index 718269a..7821eb3 100644
--- a/iridescence/src/api/dichroism.js
+++ b/iridescence/src/api/dichroism.js
@@ -54,6 +54,18 @@ export default class Dichroism {
];
}
+
+ async uploadPhoto(file) {
+ const fd = new FormData();
+ fd.append(file.name, file);
+
+ return fetch("http://localhost:8000/photos", {
+ method: "POST",
+ body: fd
+ });
+ }
+
+
getProducts() {
return this.products.slice(0);
}
diff --git a/iridescence/src/components/admin/ProductEditCard.vue b/iridescence/src/components/admin/ProductEditCard.vue
index 238c975..2784fc9 100644
--- a/iridescence/src/components/admin/ProductEditCard.vue
+++ b/iridescence/src/components/admin/ProductEditCard.vue
@@ -227,31 +227,8 @@ export default {
method: "POST",
body: fd
});
- console.log(response);
- //let reader = new FileReader();
-
- //reader.onprogress = e => {
- // if (e && e.lengthComputable) {
- // this.fileProgress = parseInt((e.loaded / e.total) * 100, 10);
- // }
- //};
-
- //reader.onloadend = e => {
- // this.fileProgress = 100;
- // this.newProduct.imgPath = file.name;
- // let formData = new FormData();
- // formData.append(file.name, e.target.result);
-
- // fetch("http://localhost:8000/photos", {
- // method: "POST",
- // body: formData
- // }).then(r => {
- // console.log(r);
- // });
- //};
-
- //reader.readAsBinaryString(file);
+ console.log(response);
}
}
};