diff --git a/src/app/blog/page.tsx b/src/app/blog/page.tsx index e8708ab..19698db 100644 --- a/src/app/blog/page.tsx +++ b/src/app/blog/page.tsx @@ -1,28 +1,26 @@ import Link from "next/link"; import { type SanityDocument } from "next-sanity"; -import { client } from "@/sanity/client"; +import { client, sanityFetch } from "@/sanity/client"; +import { Post } from "@/sanity/sanity.types"; const POSTS_QUERY = `*[ _type == "post" && defined(slug.current) ]|order(publishedAt desc)[0...12]{_id, title, slug, publishedAt}`; -const options = { next: { revalidate: 30 } }; - export default async function IndexPage() { - const posts = await client.fetch(POSTS_QUERY, {}, options); - + const posts = (await sanityFetch({ query: POSTS_QUERY, perspective: "published" })).data; return (
Home

Blog