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",
|
2024-09-07 14:59:43 +02:00
|
|
|
projectId: `${process.env.NEXT_PUBLIC_SANITY_PROJECT_ID}`,
|
2024-09-07 09:12:48 +02:00
|
|
|
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
|
|
|
}
|