From e12c7727e6f1bafd0cbb0ee3f6841a3075aab744 Mon Sep 17 00:00:00 2001 From: Arman Date: Wed, 19 Feb 2025 18:09:43 +0100 Subject: [PATCH] fix: redirection logic --- src/routes/+layout.svelte | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte index 5319ca59b..e21202297 100644 --- a/src/routes/+layout.svelte +++ b/src/routes/+layout.svelte @@ -47,12 +47,7 @@ .getCampaign(coupon.campaign) .catch(() => null); if (campaign && $user) { - const params = new URLSearchParams($page.url.searchParams); - params.delete('code'); // Remove the code param since we're using it in the new path - const searchString = params.toString(); - goto( - `${base}/apply-credit?code=${code}${searchString ? '&' + searchString : ''}` - ); + goto(`${base}/apply-credit?${$page.url.searchParams}`); loading.set(false); return; } @@ -64,12 +59,8 @@ .getCampaign(campaignId) .catch(() => null); if (campaign) { - const params = new URLSearchParams($page.url.searchParams); - params.delete('campaign'); // Remove the campaign param since we're using it in the new path - const searchString = params.toString(); - goto( - `${base}/apply-credit?campaign=${campaign.$id}${searchString ? '&' + searchString : ''}` - ); + goto(`${base}/apply-credit?${$page.url.searchParams}`); + loading.set(false); return; }