From 57f9d4364c74218393182ea1857c57cee87a7eeb Mon Sep 17 00:00:00 2001 From: gbuomprisco Date: Sat, 6 Jul 2024 16:01:47 +0800 Subject: [PATCH] Update URL pattern in middleware This change updates the URL patterns for 'admin', 'auth', and 'home' in the middleware file. The updated patterns now include a trailing wildcard and a questioning mark to match any potential following routes, which makes routing more flexible and accurate. --- apps/web/middleware.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/web/middleware.ts b/apps/web/middleware.ts index da446eecf..1b133ae70 100644 --- a/apps/web/middleware.ts +++ b/apps/web/middleware.ts @@ -132,11 +132,11 @@ async function adminMiddleware(request: NextRequest, response: NextResponse) { function getPatterns() { return [ { - pattern: new URLPattern({ pathname: '/admin*' }), + pattern: new URLPattern({ pathname: '/admin/*?' }), handler: adminMiddleware, }, { - pattern: new URLPattern({ pathname: '/auth*' }), + pattern: new URLPattern({ pathname: '/auth/*?' }), handler: async (req: NextRequest, res: NextResponse) => { const { data: { user }, @@ -160,7 +160,7 @@ function getPatterns() { }, }, { - pattern: new URLPattern({ pathname: '/home*' }), + pattern: new URLPattern({ pathname: '/home/*?' }), handler: async (req: NextRequest, res: NextResponse) => { const { data: { user },