@sanity/preview-url-secret
Warning
This is an experimental package. Breaking changes may be introduced at any time. It's not production ready.
npm i --save-exact @sanity/preview-url-secret@pink-lizard @sanity/client
Usage
TODO how to verify the secret in an API handler that enables Draft Mode
Presentation Tool
@TODO move to presentation tool docs
import { presentationTool } from '@sanity/presentation'
import { definePreviewUrl } from '@sanity/preview-url-secret/presentation'
import { visionTool } from '@sanity/vision'
import { defineConfig } from 'sanity'
import { deskTool } from 'sanity/desk'
export default defineConfig({
projectId,
dataset,
schema,
plugins: [
presentationTool({
previewUrl: definePreviewUrl({
origin: 'http://localhost:3000',
preview: '/en/home',
draftMode: {
enable: '/api/draft',
},
}),
}),
deskTool(),
visionTool(),
],
})