Implement client fetch

This commit is contained in:
Henrik Larsson
2023-07-03 14:05:31 +02:00
parent eecef825c5
commit 37e2ef06fc
3 changed files with 76 additions and 93 deletions

View File

@@ -1,4 +1,5 @@
import { createClient } from "next-sanity";
import { cache } from 'react';
export const projectId = process.env.NEXT_PUBLIC_SANITY_PROJECT_ID!;
export const dataset = process.env.NEXT_PUBLIC_SANITY_DATASET!;
@@ -9,4 +10,6 @@ export const client = createClient({
dataset,
apiVersion,
useCdn: true,
});
});
export const clientFetch = cache(client.fetch.bind(client));