2024-08-08 11:21:56 +02:00
|
|
|
import { createClient } from "next-sanity";
|
|
|
|
import imageUrlBuilder from "@sanity/image-url";
|
|
|
|
|
2024-08-08 19:23:56 +02:00
|
|
|
const config = {
|
2024-09-07 09:12:48 +02:00
|
|
|
apiVersion: "2023-08-08",
|
|
|
|
dataset: "production",
|
|
|
|
projectId: `${process.env.SANITY_PROJECT_ID}`,
|
|
|
|
useCdn: false // ensure fresh data
|
2024-08-08 19:23:56 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
export const client = createClient(config);
|
2024-08-08 11:21:56 +02:00
|
|
|
|
|
|
|
const builder = imageUrlBuilder(client);
|
|
|
|
|
|
|
|
export function urlFor(source: any) {
|
2024-09-07 09:12:48 +02:00
|
|
|
return builder.image(source);
|
2024-08-08 11:21:56 +02:00
|
|
|
}
|