Alex
Using Nuxt/Content works in nuxt dev but doesn't work after nuxt generate
const fetchData = async():Promise<BlogPost[]> => {
const { data } = await useAsyncData('blogs',() => queryContent('/blog').find())
console.log(data)
if(data.value && Array.isArray(data.value)) {
return data.value.map((item:any) => ({
description: item.description,
date: item.date,
tags: item.tags,
title: item.title,
content: item
})) as BlogPost[]
}
return []
}
this is one of the ways I'm retrieving data btw
7 replies