From 84b234c8feea0a7324b5aed62b8f2939a42c5aa9 Mon Sep 17 00:00:00 2001 From: Bharath Lakshman Kumar <108531789+BharathxD@users.noreply.github.com> Date: Sun, 25 Aug 2024 20:55:22 +0530 Subject: [PATCH] fix: invite code redirect in middleware #185 --- apps/dashboard/src/middleware.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/apps/dashboard/src/middleware.ts b/apps/dashboard/src/middleware.ts index 371b50ab6b..5e781bb55f 100644 --- a/apps/dashboard/src/middleware.ts +++ b/apps/dashboard/src/middleware.ts @@ -54,6 +54,11 @@ export async function middleware(request: NextRequest) { session && !session?.user?.user_metadata?.full_name ) { + // Check if the URL contains an invite code + const inviteCodeMatch = newUrl.pathname.startsWith("/teams/invite/"); + if (inviteCodeMatch) { + return NextResponse.redirect(`${url.origin}${newUrl.pathname}`); + } return NextResponse.redirect(`${url.origin}/setup`); }