draftMode
Whether draft mode is on for the current request (its cookie verifies with the secret).
Whether draft mode is on for the current request (its cookie verifies with the secret).
Import#
ts
import { draftMode } from "@shadow-js/dusk/server";
Signature#
ts
function draftMode(): { readonly enabled: boolean }
Returns#
{ enabled }.
Throws#
- DuskError outside a request.
Examples#
ts
export const load = async () => { const { enabled } = draftMode(); return loadPost({ drafts: enabled }); };