From 021638d3c21f42b0f315333f64c3c2ca8966e2cc Mon Sep 17 00:00:00 2001 From: Mateja Date: Tue, 27 Jul 2021 15:52:03 +0200 Subject: Show modal and clear cart on successfully purchase. Also show modal on failures... --- client/src/store/index.js | 3 +++ client/src/views/Checkout.vue | 35 +++++++++++++++++++++++++++++++---- 2 files changed, 34 insertions(+), 4 deletions(-) (limited to 'client') 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: { diff --git a/client/src/views/Checkout.vue b/client/src/views/Checkout.vue index a009b94..fc8bdd0 100644 --- a/client/src/views/Checkout.vue +++ b/client/src/views/Checkout.vue @@ -20,17 +20,32 @@ + +

+