Convert enhanceRouteHandler params into a Promise-based Dynamic API

This commit is contained in:
gbuomprisco
2024-10-22 15:08:17 +08:00
parent a99d9483d6
commit 4134315076

View File

@@ -72,7 +72,7 @@ export const enhanceRouteHandler = <
return async function routeHandler( return async function routeHandler(
request: NextRequest, request: NextRequest,
routeParams: { routeParams: {
params: Record<string, string>; params: Promise<Record<string, string>>;
}, },
) { ) {
type UserParam = Params['auth'] extends false ? undefined : User; type UserParam = Params['auth'] extends false ? undefined : User;
@@ -126,7 +126,7 @@ export const enhanceRouteHandler = <
request, request,
body, body,
user, user,
params: routeParams.params, params: await routeParams.params,
}); });
}; };
}; };