next.js/test/e2e/app-dir/app-static/app/api/draft-mode/route.ts
route.ts17 lines363 B
import { draftMode } from 'next/headers'
import { NextRequest, NextResponse } from 'next/server'

export async function GET(req: NextRequest) {
  const status = req.nextUrl.searchParams.get('status')

  if (status === 'enable') {
    ;(await draftMode()).enable()
  } else {
    ;(await draftMode()).disable()
  }

  return NextResponse.json({
    status,
  })
}
Quest for Codev2.0.0
/
SIGN IN