summaryrefslogtreecommitdiff
path: root/iridescence/src/store/index.js
diff options
context:
space:
mode:
Diffstat (limited to 'iridescence/src/store/index.js')
-rw-r--r--iridescence/src/store/index.js5
1 files changed, 5 insertions, 0 deletions
diff --git a/iridescence/src/store/index.js b/iridescence/src/store/index.js
index 8208f35..48cae11 100644
--- a/iridescence/src/store/index.js
+++ b/iridescence/src/store/index.js
@@ -36,6 +36,11 @@ export default new Vuex.Store({
cartItem(state, { id, by }) {
if (state.cart[id]) {
let newCount = (state.cart[id] += by);
+ if (newCount <= 0) {
+ // remove from cart entirely
+ delete state.cart[id];
+ return;
+ }
state.cart = {
...state.cart,
[id]: newCount