We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 01e271f commit f7ed0ddCopy full SHA for f7ed0dd
pages/checkout.vue
@@ -7,10 +7,20 @@
7
8
<script setup>
9
import { useCart } from "@/store/useCart";
10
+import { watch } from "vue";
11
+
12
const cart = useCart();
-if (cart.cart.length === 0) {
- await navigateTo("/");
13
-}
14
+watch(
15
+ () => cart.loading,
16
+ (loading) => {
17
+ if (!loading && cart.cart.length === 0) {
18
+ navigateTo("/");
19
+ }
20
+ },
21
+ { immediate: true },
22
+);
23
24
useHead({
25
title: "Checkout",
26
titleTemplate: "%s - Nuxt 3 Woocommerce",
0 commit comments