fix(sdk): make options for createNextRouteHandler optional

This commit is contained in:
Carl-Gerhard Lindesvärd
2024-12-03 20:33:46 +01:00
parent 2e3e7037bd
commit f48dcfe678

View File

@@ -2,12 +2,13 @@
// with esm and nextjs (when using pages dir)
import { NextResponse } from 'next/server.js';
export function createNextRouteHandler({
apiUrl = 'https://api.openpanel.dev',
}: {
type CreateNextRouteHandlerOptions = {
apiUrl?: string;
}) {
};
export function createNextRouteHandler(options: CreateNextRouteHandlerOptions) {
return async function POST(req: Request) {
const apiUrl = options.apiUrl ?? 'https://api.openpanel.dev';
const headers = new Headers(req.headers);
try {
const res = await fetch(`${apiUrl}/track`, {