From ba0dfd3622d5a72b07fc1085b235383b20a6f9b1 Mon Sep 17 00:00:00 2001
From: Mateja <mail@matejamaric.com>
Date: Sun, 25 Jul 2021 16:45:55 +0200
Subject: Allow product removal on Checkout page.

---
 client/src/views/Checkout.vue | 6 ++++++
 1 file changed, 6 insertions(+)

(limited to 'client/src/views/Checkout.vue')

diff --git a/client/src/views/Checkout.vue b/client/src/views/Checkout.vue
index 83d0940..8adeb4a 100644
--- a/client/src/views/Checkout.vue
+++ b/client/src/views/Checkout.vue
@@ -10,6 +10,7 @@
               <i>${{ item.price }}</i>
             </div>
             <span class="badge bg-primary rounded-pill">{{ item.quantity }}</span>
+            <span class="badge bg-danger rounded-pill ms-2" @click="remove(item.id)">x</span>
           </li>
         </ul>
         <p class="text-center my-3 fw-bold">You can buy {{ cartSize }} items for ${{ cartPrice }}.</p>
@@ -31,6 +32,11 @@ export default {
     cartPrice() {
       return this.$store.getters.getCartPrice;
     }
+  },
+  methods: {
+    remove(id) {
+      this.$store.commit('removeFromCart', id);
+    }
   }
 }
 </script>
-- 
cgit v1.2.3

