Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions packages/server/src/next/app-route-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { AppRouteRequestHandlerOptions } from '.';
import { RPCApiHandler } from '../api';
import { loadAssets } from '../shared';

type Context = { params: { path: string[] } };
type Context = { params: Promise<{ path: string[] }> };

/**
* Creates a Next.js 13 "app dir" API route request handler which encapsulates Prisma CRUD operations.
Expand All @@ -28,17 +28,18 @@ export default function factory(
}

const url = new URL(req.url);
const params = await context.params;
const query = Object.fromEntries(url.searchParams);

if (!context.params.path) {
if (!params.path) {
return NextResponse.json(
{ message: 'missing path parameter' },
{
status: 400,
}
);
}
const path = context.params.path.join('/');
const path = params.path.join('/');

let requestBody: unknown;
if (req.body) {
Expand Down