svrjs-nextjs-website/lib/getBlogPost.ts

13 lines
274 B
TypeScript
Raw Permalink Normal View History

2024-08-24 06:28:25 +02:00
import { client } from "./sanity";
export const getAllBlogPostSlugs = async () => {
const query = `*[_type == 'blog'] { "slug": slug.current }`;
const slugs: { slug: string }[] = await client.fetch(
query,
{},
{ cache: "no-store" }
);
2024-08-24 06:28:25 +02:00
return slugs;
2024-08-24 06:28:25 +02:00
};