Skip to content

Commit f7ed0dd

Browse files
committed
Fix checkout
1 parent 01e271f commit f7ed0dd

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

pages/checkout.vue

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,20 @@
77

88
<script setup>
99
import { useCart } from "@/store/useCart";
10+
import { watch } from "vue";
11+
1012
const cart = useCart();
11-
if (cart.cart.length === 0) {
12-
await navigateTo("/");
13-
}
13+
14+
watch(
15+
() => cart.loading,
16+
(loading) => {
17+
if (!loading && cart.cart.length === 0) {
18+
navigateTo("/");
19+
}
20+
},
21+
{ immediate: true },
22+
);
23+
1424
useHead({
1525
title: "Checkout",
1626
titleTemplate: "%s - Nuxt 3 Woocommerce",

0 commit comments

Comments
 (0)