Skip to content

Commit

Permalink
fix: returnTo on login redirect
Browse files Browse the repository at this point in the history
  • Loading branch information
theClarkSell committed Jan 6, 2024
1 parent d7eb8e9 commit 531759b
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/routes/login/+server.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,17 @@ import { redirect, error } from '@sveltejs/kit';
import * as Sentry from '@sentry/sveltekit';

export async function GET({ fetch, locals, url }) {
const returnTo = url.searchParams?.get('returnTo') || '/';
const { searchParams } = url;

let returnTo = url.searchParams?.get('returnTo') || '/';

if (searchParams.size > 1) {
if (returnTo.length > 1) {
searchParams.delete('returnTo');
returnTo = `${returnTo}?${searchParams.toString()}`;
}
}

let _url = '/';
try {
const session = await locals.getSession();
Expand Down

0 comments on commit 531759b

Please sign in to comment.