diff options
author | Mateja <mail@matejamaric.com> | 2021-07-27 15:52:03 +0200 |
---|---|---|
committer | Mateja <mail@matejamaric.com> | 2021-07-27 15:52:03 +0200 |
commit | 021638d3c21f42b0f315333f64c3c2ca8966e2cc (patch) | |
tree | 3aefc1de13bd83375db8ef53e181245aff7f7939 /client/src/store | |
parent | ea671474106d6416fb4d90da05c34d916b6ca5a2 (diff) | |
download | mevn-ecommerce-021638d3c21f42b0f315333f64c3c2ca8966e2cc.tar.gz mevn-ecommerce-021638d3c21f42b0f315333f64c3c2ca8966e2cc.zip |
Show modal and clear cart on successfully purchase.
Also show modal on failures...
Diffstat (limited to 'client/src/store')
-rw-r--r-- | client/src/store/index.js | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/client/src/store/index.js b/client/src/store/index.js index a2d3f9f..7c3d396 100644 --- a/client/src/store/index.js +++ b/client/src/store/index.js @@ -65,6 +65,9 @@ export default createStore({ if (foundProduct.quantity == 0) state.cart = state.cart.filter(x => x.id != foundProduct.id); } + }, + clearCart(state) { + state.cart.length = 0; } }, actions: { |