@prismicio/next
Version:
Helpers to integrate Prismic into Next.js apps
29 lines (28 loc) • 1.22 kB
TypeScript
import { type Client, type LinkResolverFunction } from "@prismicio/client";
import { NextRequestLike } from "./types";
export type RedirectToPreviewURLConfig = {
/** The Prismic client configured for the preview session's repository. */
client: Pick<Client, "resolvePreviewURL">;
/**
* The `request` object from a Next.js Route Handler.
*
* @see Next.js Route Handler docs: \<https://nextjs.org/docs/app/building-your-application/routing/route-handlers\>
*/
request: NextRequestLike;
/**
* A Link Resolver used to resolve the previewed document's URL.
*
* @see To learn more about Link Resolver: {@link https://prismic.io/docs/core-concepts/link-resolver-route-resolver}
*/
linkResolver?: LinkResolverFunction;
/**
* The default redirect URL if a URL cannot be determined for the previewed
* document.
*
* **Note**: If you `next.config.js` file contains a `basePath`, the
* `defaultURL` option must _not_ include it. Instead, provide the `basePath`
* property using the `basePath` option.
*/
defaultURL?: string;
};
export declare function redirectToPreviewURL(config: RedirectToPreviewURLConfig): Promise<never>;