chore: refactor apiRouteMiddleware and add it to some api routes in App Router (#19146)
* chore: remove try and catch from api routes in app router * refactor * refactor apiRouteMiddleware * refactor
This commit is contained in:
1 parent
24a080b988
commit
e79af63e6c
6 files changed
+127
-156
No files matched your search
@@ -6,7 +6,7 @@ import { NextResponse } from "next/server";
|
||||
import { getServerErrorFromUnknown } from "./getServerErrorFromUnknown";
|
||||
|
||||
export const apiRouteMiddleware =
|
||||
(handler: (req: Request, res?: Response) => Promise<Response>) =>
|
||||
(handler: (req: NextRequest, res?: NextResponse) => Promise<NextResponse>) =>
|
||||
async (req: NextRequest, res: NextResponse) => {
|
||||
try {
|
||||
return await handler(req, res);
|
||||
|
||||
Reference in new issue
Block a user