Skip to content

Commit

Permalink
type error
Browse files Browse the repository at this point in the history
  • Loading branch information
joelvarty committed Jul 5, 2024
1 parent beb0eee commit 9772efa
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions app/api/preview/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@ export async function GET(request: NextRequest, res: NextResponse) {
const slug = request.nextUrl.pathname

const ContentID = searchParams.get('ContentID')
const contentID = parseInt(ContentID || "")

console.log("Preview Request", { agilityPreviewKey, slug, ContentID, url: request.nextUrl.toString() })
console.log("Preview Request", { agilityPreviewKey, slug, contentID, url: request.nextUrl.toString() })


//validate our preview key, also validate the requested page to preview exists
Expand All @@ -40,8 +41,8 @@ export async function GET(request: NextRequest, res: NextResponse) {
let previewUrl = slug;

//TODO: these kinds of dynamic links should work by default (even outside of preview)
if (ContentID) {
const dynamicPath = await getDynamicPageURL({ contentID: ContentID, preview: true, slug });
if (!isNaN(contentID) && contentID > 0) {
const dynamicPath = await getDynamicPageURL({ contentID, preview: true, slug });
if (dynamicPath) {
previewUrl = dynamicPath;
}
Expand Down

0 comments on commit 9772efa

Please sign in to comment.