Files
supabase/apps/www/app/api-v2/cms/disable-draft/route.ts
Francesco Sansalvadore 2feda5ee19 cms www blog (#38045)
* show cms blog posts in www
* remove contentlayer from www
* outputFileTracingExcludes
* update remotePatterns
* fetch cms posts server-side with revalidation
* add cms env vars to turbo.json
* add www env vars to turbo.json
* include cms posts in www sitemap
* add migration to remove image from cms post
* update cms meta image mapping in www
2025-09-03 14:49:28 +02:00

16 lines
471 B
TypeScript

import { draftMode } from 'next/headers'
import { redirect } from 'next/navigation'
export async function GET(request: Request) {
const draft = await draftMode()
const { searchParams } = new URL(request.url)
const slug = searchParams.get('slug')
const path = searchParams.get('path') || 'blog'
// Disable Draft Mode by clearing the cookie
draft.disable()
// Redirect to the path from the fetched post
redirect(slug ? `/${path}/${slug}` : `/${path}`)
}