Skip to content

Commit

Permalink
fix final redirection
Browse files Browse the repository at this point in the history
  • Loading branch information
motatoes committed Oct 20, 2024
1 parent 7f624f1 commit 7b6c98e
Showing 1 changed file with 2 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,20 +27,18 @@ export async function GET(request: Request) {
const userId = data.user?.id;
createDefaultUserProfile(userId!);
createDefaultUserPrivateInfo(userId!);

console.log('Session set successfully:', data.session);
} catch (error) {
console.error('Error setting session:', error);
}
}

let redirectTo = new URL('/dashboard', requestUrl.origin);
let redirectTo = '/dashboard';

if (next) {
// decode next param
const decodedNext = decodeURIComponent(next);
// validate next param
redirectTo = new URL(decodedNext, requestUrl.origin);
redirectTo = decodedNext;
}

return NextResponse.redirect(redirectTo);
Expand Down

0 comments on commit 7b6c98e

Please sign in to comment.