fix: ts issue for nextjs sdk

This commit is contained in:
Carl-Gerhard Lindesvärd
2025-11-14 13:26:08 +01:00
parent 87e98baeb3
commit 2b0b62d64c

View File

@@ -7,9 +7,11 @@ type CreateNextRouteHandlerOptions = {
apiUrl?: string; apiUrl?: string;
}; };
export function createNextRouteHandler(options: CreateNextRouteHandlerOptions) { export function createNextRouteHandler(
options?: CreateNextRouteHandlerOptions,
) {
return async function POST(req: Request) { return async function POST(req: Request) {
const apiUrl = options.apiUrl ?? 'https://api.openpanel.dev'; const apiUrl = options?.apiUrl ?? 'https://api.openpanel.dev';
const headers = new Headers(req.headers); const headers = new Headers(req.headers);
try { try {
const res = await fetch(`${apiUrl}/track`, { const res = await fetch(`${apiUrl}/track`, {