fix: ts issue for nextjs sdk
This commit is contained in:
@@ -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`, {
|
||||||
|
|||||||
Reference in New Issue
Block a user