UNPKG

next-sanity

Version:
40 lines 1.2 kB
import { SanityClient } from "@sanity/client"; /** * @public */ interface DefineEnableDraftModeOptions { client: SanityClient; /** * Force secure cookies in development mode. * Enable this when using Next.js --experimental-https flag. * This option has no effect in production (cookies are always secure). * @defaultValue false */ secureDevMode?: boolean; } /** * @public */ interface EnableDraftMode { GET: (request: Request) => Promise<Response>; } /** * Sets up an API route for enabling draft mode, can be paired with the `previewUrl.previewMode.enable` in `sanity/presentation`. * Can also be used with `sanity-plugin-iframe-pane`. * @example * ```ts * // src/app/api/draft-mode/enable/route.ts * * import { defineEnableDraftMode } from "next-sanity/draft-mode"; * import { client } from "@/sanity/lib/client"; * * export const { GET } = defineEnableDraftMode({ * client: client.withConfig({ token: process.env.SANITY_API_READ_TOKEN }), * }); * ``` * * @public */ declare function defineEnableDraftMode(options: DefineEnableDraftModeOptions): EnableDraftMode; export { DefineEnableDraftModeOptions, EnableDraftMode, defineEnableDraftMode }; //# sourceMappingURL=index.d.ts.map