From def079e50e911b13866dfda07c53a3748bd9271f Mon Sep 17 00:00:00 2001 From: Bram Suurd Date: Wed, 28 Aug 2024 15:10:47 +0200 Subject: [PATCH] refactor: updated Open Graph API to use NextRequest for title parameter extraction --- src/app/api/og/route.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/app/api/og/route.tsx b/src/app/api/og/route.tsx index 9b5e54f..7895217 100644 --- a/src/app/api/og/route.tsx +++ b/src/app/api/og/route.tsx @@ -1,6 +1,7 @@ import { pb } from "@/lib/pocketbase"; import { Script } from "@/lib/types"; import { ImageResponse } from "next/og"; +import { NextRequest } from "next/server"; import { ClientResponseError } from 'pocketbase'; const size = { @@ -8,8 +9,8 @@ const size = { height: 630, }; -export async function GET({ params }: { params: { title: string } }) { - const title = params.title; +export async function GET(req: NextRequest) { + const title = req.nextUrl.searchParams.get("title"); if (!title) { return new Response("Missing title parameter", { status: 400 });