From 7381a7033231e6454a37fd64b1f3de4e8d59355f Mon Sep 17 00:00:00 2001 From: "Adam T. Carpenter" Date: Wed, 11 Nov 2020 20:07:12 -0500 Subject: Kind of flailing with the UI; lots of API bugfixes though. --- iridescence/src/api/dichroism.js | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'iridescence/src/api') diff --git a/iridescence/src/api/dichroism.js b/iridescence/src/api/dichroism.js index 610941c..c2cc93c 100644 --- a/iridescence/src/api/dichroism.js +++ b/iridescence/src/api/dichroism.js @@ -18,7 +18,7 @@ export default class Dichroism { const photos = await this._sendRequest("photos", options); return photos.map(p => new PhotoSet(p)); } catch (err) { - console.error(err.message); + console.error("Dichroism: " + err.message); return null; } } @@ -28,7 +28,7 @@ export default class Dichroism { const products = await this._sendRequest("products", null); return products.map(p => new Product(p)); } catch (err) { - console.error(err.message); + console.error("Dichroism: " + err.message); return []; } } @@ -36,14 +36,17 @@ export default class Dichroism { async updateProduct(fieldDiff) { const options = { method: "PATCH", - body: fieldDiff + headers: { + "Content-Type": "application/json" + }, + body: JSON.stringify(fieldDiff) }; try { const product = await this._sendRequest("products", options); return new Product(product); } catch (err) { - console.error(err.message); + console.error("Dichroism: " + err.message); return null; } } @@ -51,14 +54,17 @@ export default class Dichroism { async createProduct(newProduct) { const options = { method: "POST", - body: newProduct + headers: { + "Content-Type": "application/json" + }, + body: JSON.stringify(newProduct) }; try { const product = await this._sendRequest("products", options); return new Product(product); } catch (err) { - console.error(err.message); + console.error("Dichroism: " + err.message); return null; } } -- cgit v1.2.3