Skip to content

Commit

Permalink
fix: invite code redirect in middleware midday-ai#185
Browse files Browse the repository at this point in the history
  • Loading branch information
BharathxD committed Aug 25, 2024
1 parent de453c3 commit 84b234c
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions apps/dashboard/src/middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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`);
}

Expand Down

0 comments on commit 84b234c

Please sign in to comment.