File tree Expand file tree Collapse file tree 2 files changed +13
-7
lines changed Expand file tree Collapse file tree 2 files changed +13
-7
lines changed Original file line number Diff line number Diff line change 7
7
8
8
<script setup>
9
9
import { useCart } from " @/store/useCart" ;
10
+ import { watch } from " vue" ;
11
+
10
12
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
+
14
24
useHead ({
15
25
title: " Checkout" ,
16
26
titleTemplate: " %s - Nuxt 3 Woocommerce" ,
Original file line number Diff line number Diff line change @@ -7,13 +7,9 @@ import GET_SINGLE_PRODUCT_QUERY from "@/apollo/queries/GET_SINGLE_PRODUCT_QUERY.
7
7
8
8
const route = useRoute ();
9
9
10
- console .log (" Route:" , route .query );
11
-
12
10
const variables = { id: route .query .id };
13
11
const { data } = await useAsyncQuery (GET_SINGLE_PRODUCT_QUERY , variables);
14
12
15
- console .log (" Data:" , data);
16
-
17
13
useHead ({
18
14
title: route .params .product ,
19
15
titleTemplate: " %s - Nuxt 3 Woocommerce" ,
You can’t perform that action at this time.
0 commit comments