summaryrefslogtreecommitdiffstats
path: root/frontend/components/AddToCart.js
diff options
context:
space:
mode:
authorWes Bos <wesbos@gmail.com>2018-04-12 16:31:01 -0400
committerWes Bos <wesbos@gmail.com>2018-04-12 16:31:01 -0400
commit97b6de6aa437f7a913a33b9e6aa18a919faf2caf (patch)
tree431e12a535baf1d2ad59601ee7c5e8084ae7a263 /frontend/components/AddToCart.js
parentd22616d5a675f5a381c741784333151255713b45 (diff)
a whole bunch of things that should be in their own commits
Diffstat (limited to 'frontend/components/AddToCart.js')
-rw-r--r--frontend/components/AddToCart.js6
1 files changed, 5 insertions, 1 deletions
diff --git a/frontend/components/AddToCart.js b/frontend/components/AddToCart.js
index 3566c0c..18186d8 100644
--- a/frontend/components/AddToCart.js
+++ b/frontend/components/AddToCart.js
@@ -18,7 +18,11 @@ class AddToCart extends Component {
const existingIndex = data.me.cart.findIndex(cartItem => cartItem.id === newCartItem.id);
if (existingIndex >= 0) {
// already in cache, just replace it
- data.me.cart = [...data.me.cart.slice(0, existingIndex), newCartItem, ...data.me.cart.slice(existingIndex + 1)];
+ data.me.cart = [
+ ...data.me.cart.slice(0, existingIndex),
+ newCartItem,
+ ...data.me.cart.slice(existingIndex + 1),
+ ];
} else {
data.me.cart = [...data.me.cart, newCartItem];
}