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.
This commit is contained in:
@@ -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 },
|
||||
|
||||
Reference in New Issue
Block a user