mirror of
https://github.com/vercel/commerce.git
synced 2025-07-23 04:36:49 +00:00
Added preview functionality for pages
This commit is contained in:
@@ -3,7 +3,7 @@ import { draftMode } from 'next/headers'
|
||||
export async function GET(request: Request) {
|
||||
const { searchParams } = new URL(request.url)
|
||||
const secret = searchParams.get('secret')
|
||||
// const slug = searchParams.get('slug')
|
||||
const slug = searchParams.get('slug')
|
||||
const type = searchParams.get('type')
|
||||
const locale = searchParams.get('locale')
|
||||
|
||||
@@ -15,7 +15,6 @@ export async function GET(request: Request) {
|
||||
|
||||
draftMode().enable()
|
||||
|
||||
|
||||
if (type === 'home') {
|
||||
return new Response(null, {
|
||||
status: 307,
|
||||
@@ -24,4 +23,13 @@ export async function GET(request: Request) {
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
if (type === 'page') {
|
||||
return new Response(null, {
|
||||
status: 307,
|
||||
headers: {
|
||||
Location: `/${locale}${slug}`,
|
||||
},
|
||||
})
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user