From 01de71698b91bc61e61d076f9c25d1cabb039b18 Mon Sep 17 00:00:00 2001 From: "Adam T. Carpenter" Date: Sat, 7 Nov 2020 08:06:57 -0500 Subject: demo-able photo upload --- iridescence/src/api/dichroism.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'iridescence/src/api') 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); } -- cgit v1.2.3