svrjs-nextjs-website/lib/getBlogPost.ts
Dorian Niemiec e3ec044db8
Some checks failed
Deploy Next.js application / deploy (push) Has been cancelled
fix: disable cache for Sanity GROQ query for getting all the blog post slugs
2024-09-13 16:14:41 +02:00

12 lines
274 B
TypeScript

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" }
);
return slugs;
};