Update UI layout and update request handler types
The UI layout has been updated to fix full screen display issues and enable class names in Sidebar. Separately, request handler function types have been improved in next route handlers for better flexibility and type safety.
This commit is contained in:
@@ -22,12 +22,12 @@ interface Config<Schema> {
|
||||
}
|
||||
|
||||
interface HandlerParams<
|
||||
Body extends object,
|
||||
Schema extends z.ZodType | undefined,
|
||||
RequireAuth extends boolean | undefined,
|
||||
> {
|
||||
request: NextRequest;
|
||||
user: RequireAuth extends false ? undefined : User;
|
||||
body: Body;
|
||||
body: Schema extends z.ZodType ? z.infer<Schema> : never;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -51,19 +51,17 @@ interface HandlerParams<
|
||||
*
|
||||
*/
|
||||
export const enhanceRouteHandler = <
|
||||
Body extends object,
|
||||
Schema extends z.ZodType<Body, z.ZodTypeDef>,
|
||||
Params extends Config<Schema> = Config<Schema>,
|
||||
Body,
|
||||
Params extends Config<z.ZodType<Body, z.ZodTypeDef>>,
|
||||
>(
|
||||
// Route handler function
|
||||
handler:
|
||||
| ((
|
||||
params: HandlerParams<z.infer<Schema>, Params['auth']>,
|
||||
params: HandlerParams<Params['schema'], Params['auth']>,
|
||||
) => NextResponse | Response)
|
||||
| ((
|
||||
params: HandlerParams<z.infer<Schema>, Params['auth']>,
|
||||
params: HandlerParams<Params['schema'], Params['auth']>,
|
||||
) => Promise<NextResponse | Response>),
|
||||
|
||||
// Parameters object
|
||||
params?: Params,
|
||||
) => {
|
||||
|
||||
Reference in New Issue
Block a user