summaryrefslogtreecommitdiff
path: root/iridescence/src/api
diff options
context:
space:
mode:
Diffstat (limited to 'iridescence/src/api')
-rw-r--r--iridescence/src/api/dichroism.js29
1 files changed, 19 insertions, 10 deletions
diff --git a/iridescence/src/api/dichroism.js b/iridescence/src/api/dichroism.js
index ff64ced..718269a 100644
--- a/iridescence/src/api/dichroism.js
+++ b/iridescence/src/api/dichroism.js
@@ -9,7 +9,7 @@ export default class Dichroism {
imgPath: "/beach_box.jpg",
description: "This is a beach box.",
featured: false,
- categories: ["Fused Glass", ["Beachy"]]
+ categories: ["Fused Glass", "Beachy"]
},
{
id: 2,
@@ -19,7 +19,7 @@ export default class Dichroism {
imgPath: "/wind-chime.jpg",
description: "Makes noise when the wind blows.",
featured: false,
- categories: ["Fused Glass", ["Beachy"]]
+ categories: ["Fused Glass", "Beachy"]
},
{
id: 3,
@@ -29,7 +29,7 @@ export default class Dichroism {
imgPath: "/beach_box.jpg",
description: "This is a beach box.",
featured: false,
- categories: ["Stained Glass", ["Christmas"]]
+ categories: ["Stained Glass", "Christmas"]
},
{
id: 4,
@@ -39,7 +39,7 @@ export default class Dichroism {
imgPath: "/wind-chime.jpg",
description: "Makes noise when the wind blows.",
featured: false,
- categories: ["Fused Glass", ["Kiln-y"]]
+ categories: ["Fused Glass", "Kiln-y"]
},
{
id: 5,
@@ -49,22 +49,31 @@ export default class Dichroism {
imgPath: "/beach_box.jpg",
description: "This is a beach box.",
featured: true,
- categories: ["Stained Glass", ["Christmas"]]
+ categories: ["Stained Glass", "Christmas"]
}
];
}
getProducts() {
- return this.products;
+ return this.products.slice(0);
}
- updateProduct(product) {
- if (!product) {
+ updateProduct(newProduct) {
+ if (!newProduct) {
return;
}
+
for (let i = 0; i < this.products.length; i++) {
- if (product.id == this.products[i].id) {
- this.products[i] = product;
+ if (newProduct.id == this.products[i].id) {
+ let currentProduct = this.products[i];
+ currentProduct.id = newProduct.id;
+ currentProduct.name = newProduct.name;
+ currentProduct.quantity = newProduct.quantity;
+ currentProduct.cents = newProduct.cents;
+ currentProduct.imgPath = newProduct.imgPath;
+ currentProduct.description = newProduct.description;
+ currentProduct.featured = newProduct.featured;
+ currentProduct.categories = newProduct.categories.slice(0);
return;
}
}