From fe8c2c424403eac8b4a460caa7dfdc37ca2baa3b Mon Sep 17 00:00:00 2001 From: XShine555 Date: Sun, 5 Jul 2026 23:16:25 +0200 Subject: [PATCH] fix(frontend): full-page nav for auth links; land on home after login - Add data-sveltekit-reload to the /login links so the browser performs a full navigation (the client router intercepted them and aborted on the external Zitadel redirect) - Default post-login returnTo to / (home) since /explore is not built yet - 'Empezar gratis' now starts the register flow (/login?mode=register) --- frontend/src/lib/components/Footer.svelte | 2 +- frontend/src/lib/components/Navbar.svelte | 7 ++++++- frontend/src/routes/+page.svelte | 3 ++- frontend/src/routes/auth/callback/+server.ts | 2 +- frontend/src/routes/login/+server.ts | 2 +- 5 files changed, 11 insertions(+), 5 deletions(-) diff --git a/frontend/src/lib/components/Footer.svelte b/frontend/src/lib/components/Footer.svelte index b0344b7..967d27c 100644 --- a/frontend/src/lib/components/Footer.svelte +++ b/frontend/src/lib/components/Footer.svelte @@ -5,7 +5,7 @@

© {new Date().getFullYear()} Musify · Streaming de música.

Explorar - Entrar + Entrar
diff --git a/frontend/src/lib/components/Navbar.svelte b/frontend/src/lib/components/Navbar.svelte index 7384452..af3d981 100644 --- a/frontend/src/lib/components/Navbar.svelte +++ b/frontend/src/lib/components/Navbar.svelte @@ -48,11 +48,16 @@ {:else} - + Iniciar sesión Registrarse diff --git a/frontend/src/routes/+page.svelte b/frontend/src/routes/+page.svelte index 1136baa..578ca35 100644 --- a/frontend/src/routes/+page.svelte +++ b/frontend/src/routes/+page.svelte @@ -45,7 +45,8 @@
Empezar gratis diff --git a/frontend/src/routes/auth/callback/+server.ts b/frontend/src/routes/auth/callback/+server.ts index a3e06e2..1fed090 100644 --- a/frontend/src/routes/auth/callback/+server.ts +++ b/frontend/src/routes/auth/callback/+server.ts @@ -16,7 +16,7 @@ export const GET: RequestHandler = async ({ url, cookies }) => { const codeVerifier = cookies.get(VERIFIER_COOKIE); const state = cookies.get(STATE_COOKIE); const nonce = cookies.get(NONCE_COOKIE); - const returnTo = cookies.get(RETURN_COOKIE) ?? '/explore'; + const returnTo = cookies.get(RETURN_COOKIE) ?? '/'; if (!codeVerifier || !state) { error(400, 'Estado de autenticación inválido. Vuelve a iniciar sesión.'); diff --git a/frontend/src/routes/login/+server.ts b/frontend/src/routes/login/+server.ts index e21b548..050f39f 100644 --- a/frontend/src/routes/login/+server.ts +++ b/frontend/src/routes/login/+server.ts @@ -20,7 +20,7 @@ export const GET: RequestHandler = async ({ url, cookies }) => { const nonce = client.randomNonce(); const register = url.searchParams.get('mode') === 'register'; - const returnTo = url.searchParams.get('returnTo') ?? '/explore'; + const returnTo = url.searchParams.get('returnTo') ?? '/'; const parameters: Record = { redirect_uri: authConfig.redirectUri,