Draft Mode
Using draft mode with NextDrupal client.
To implement draft mode, configure entity types on Drupal. See the guide here.
- Implement
/app/api/draft/route.ts
.
app/api/draft/route.ts
import { drupal } from "@/lib/drupal"import { enableDraftMode } from "next-drupal/draft"import type { NextRequest } from "next/server"
export async function GET(request: NextRequest): Promise<Response | never> { return enableDraftMode(request, drupal)}
- Implement
/app/api/disable-draft/route.ts
app/api/disable-draft/route.ts
import { disableDraftMode } from "next-drupal/draft"import type { NextRequest } from "next/server"
export async function GET(request: NextRequest) { return disableDraftMode()}