diff --git a/components/Cart/CartContents.vue b/components/Cart/CartContents.vue index 1f08b7fc..6e3db5d3 100644 --- a/components/Cart/CartContents.vue +++ b/components/Cart/CartContents.vue @@ -32,7 +32,7 @@ * @module CartContents * @returns {Object} The Vue.js component object. */ -import { computed, ref, onMounted } from "vue"; +import { computed } from "vue"; import { useCart } from "@/store/useCart"; const props = defineProps({ @@ -43,9 +43,10 @@ const props = defineProps({ }); const cart = useCart(); -const isLoading = ref(true); -const error = ref(null); +// Use the store's reactive state directly +const isLoading = computed(() => cart.loading); +const error = computed(() => cart.error); const cartItems = computed(() => cart.cart); /** @@ -59,16 +60,6 @@ const handleRemoveProduct = async (key) => { } catch (error) {} }; -onMounted(async () => { - try { - await cart.refetch(); - } catch (err) { - error.value = err; - } finally { - isLoading.value = false; - } -}); - /** * Handles updating the quantity of a cart item. * diff --git a/components/Layout/LayoutCart.vue b/components/Layout/LayoutCart.vue index 51b816b1..f8ccbdce 100644 --- a/components/Layout/LayoutCart.vue +++ b/components/Layout/LayoutCart.vue @@ -48,24 +48,15 @@