diff options
author | Adam T. Carpenter <atc@53hor.net> | 2020-11-11 20:07:12 -0500 |
---|---|---|
committer | Adam T. Carpenter <atc@53hor.net> | 2020-11-11 20:07:12 -0500 |
commit | 7381a7033231e6454a37fd64b1f3de4e8d59355f (patch) | |
tree | 7ae54976c2d036e0fe7cb199a7f6facdd09bbb6d /iridescence/src/api/dichroism.js | |
parent | c5280144de096c274f185fade287ccd63b954ceb (diff) | |
download | theglassyladies-7381a7033231e6454a37fd64b1f3de4e8d59355f.tar.xz theglassyladies-7381a7033231e6454a37fd64b1f3de4e8d59355f.zip |
Kind of flailing with the UI; lots of API bugfixes though.
Diffstat (limited to 'iridescence/src/api/dichroism.js')
-rw-r--r-- | iridescence/src/api/dichroism.js | 18 |
1 files changed, 12 insertions, 6 deletions
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; } } |