Skip to content

Commit dc28925

Browse files
committed
fix: error caused by incorrect imports
1 parent b7742a7 commit dc28925

File tree

2 files changed

+21
-5
lines changed

2 files changed

+21
-5
lines changed

composables/useMenuItems.js renamed to composables/useMenuItems.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
import { queryCollection, useAsyncData } from '@nuxt/content'
2-
3-
export default function () {
4-
async function fetchMenuItems(menu) {
1+
export default function useMenuItems() {
2+
async function fetchMenuItems(menu: string) {
53
return await queryCollection('menu')
64
.where('stem', '=', `menu/${menu}`)
75
.first()
@@ -10,7 +8,7 @@ export default function () {
108
return await queryCollection('menu').all()
119
}
1210

13-
async function fetchMenuItemsAsync(menu) {
11+
async function fetchMenuItemsAsync(menu: string) {
1412
const path = `menu/${menu}`
1513
return await useAsyncData(
1614
path,

content.config.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import { defineCollection, defineContentConfig, z } from '@nuxt/content'
2+
3+
export default defineContentConfig({
4+
collections: {
5+
menu: defineCollection({
6+
source: 'menu/**.yml',
7+
type: 'data',
8+
schema: z.object({
9+
items: z.array(
10+
z.object({
11+
title: z.string(),
12+
path: z.string(),
13+
}),
14+
),
15+
}),
16+
}),
17+
},
18+
})

0 commit comments

Comments
 (0)