Skip to content

Commit bcc85b9

Browse files
committed
Categories as props
1 parent 478a17f commit bcc85b9

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

components/Category/CategoryShowAll.vue

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,10 @@
3333
</template>
3434

3535
<script setup>
36-
import FETCH_ALL_CATEGORIES_QUERY from "@/apollo/queries/FETCH_ALL_CATEGORIES_QUERY.gql";
37-
38-
const variables = { limit: 99 };
39-
const { data } = await useAsyncQuery(FETCH_ALL_CATEGORIES_QUERY, variables);
36+
const props = defineProps({
37+
data: {
38+
type: Object,
39+
required: true
40+
}
41+
});
4042
</script>

pages/categories.vue

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
<template>
22
<div class="flex justify-center items-center">
3-
<CategoryShowAll />
3+
<CategoryShowAll :data="data" />
44
</div>
55
</template>
66

77
<script setup>
8+
import FETCH_ALL_CATEGORIES_QUERY from "@/apollo/queries/FETCH_ALL_CATEGORIES_QUERY.gql";
9+
const variables = { limit: 99 };
10+
const { data } = await useAsyncQuery(FETCH_ALL_CATEGORIES_QUERY, variables);
11+
812
useHead({
913
title: "Categories",
1014
titleTemplate: "%s - Nuxt 3 Woocommerce",

0 commit comments

Comments
 (0)