Hi all,
I'm having trouble getting a Linked Data.
Since it's using the default tsx, it keeps getting this error.
Type error: Property 'data' does not exist on type 'ContentRelationshipField<"category">'.
But I didn't find any official documentation on how to handle this process.
export default async function Page() {
const client = createClient();
const pageNumber = getPageNumber();
const categories = await client.getByType('category')
const posts = await client.getByType('blog', {
orderings: {
field: 'document.first_publication_date',
direction: 'desc',
},
fetchLinks: ['category.uid', 'category.name'],
pageSize: 10,
page: pageNumber,
})
return(
{posts.results.map((post) => (
<article key={post.id} >
<Link href={`/blog/category/${post.data.category.data.uid}`}>
{post.data.category.data.name}
</Link>
</article>
);
}