mernmail-website/sanity/lib/client.js

18 lines
457 B
JavaScript

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