@prismicio/next
Version:
Helpers to integrate Prismic into Next.js apps
22 lines • 800 B
TypeScript
//#region src/getPreviewRef.d.ts
/**
* Reads the Prismic preview ref for the current request when an active preview session exists.
*
* This is the read-side counterpart to `redirectToPreviewURL`, which writes the preview cookie. Use
* it with Next.js Cache Components to read the ref _outside_ a cached function and pass it _in_ as
* an argument so it becomes part of the cache key:
*
* @example
* ;```typescript
* import { getPreviewRef } from "@prismicio/next"
*
* const page = await fetchPage(uid, await getPreviewRef())
* ```
*
* @returns The active preview ref, or `undefined` if no preview session is active.
* @experimental
*/
declare function getPreviewRef(): Promise<string | undefined>;
//#endregion
export { getPreviewRef };
//# sourceMappingURL=getPreviewRef.d.ts.map