2024-11-08 09:43:04 +01:00
|
|
|
import { createClient } from "next-sanity";
|
2024-11-08 11:04:55 +01:00
|
|
|
import imageUrlBuilder from "@sanity/image-url";
|
2024-11-08 09:43:04 +01:00
|
|
|
|
2024-11-08 11:04:55 +01:00
|
|
|
import { apiVersion, dataset, projectId, token } from "../env";
|
2024-11-08 09:43:04 +01:00
|
|
|
|
|
|
|
export const client = createClient({
|
|
|
|
projectId,
|
|
|
|
dataset,
|
|
|
|
apiVersion,
|
2024-11-08 11:04:55 +01:00
|
|
|
token,
|
|
|
|
useCdn: false // Set to false if statically generating pages, using ISR or tag-based revalidation
|
2024-11-08 09:43:04 +01:00
|
|
|
});
|
2024-11-08 11:04:55 +01:00
|
|
|
|
|
|
|
const builder = imageUrlBuilder(client);
|
|
|
|
|
|
|
|
export function urlFor(source) {
|
|
|
|
return builder.image(source);
|
|
|
|
}
|