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)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-07-05 23:16:25 +02:00
co-authored by Claude Opus 4.8
parent f8d4f83152
commit 66cb970dd2
5 changed files with 11 additions and 5 deletions
+1 -1
View File
@@ -5,7 +5,7 @@
<p>© {new Date().getFullYear()} Musify · Streaming de música.</p> <p>© {new Date().getFullYear()} Musify · Streaming de música.</p>
<div class="flex gap-6"> <div class="flex gap-6">
<a href="/explore" class="transition hover:text-neutral-300">Explorar</a> <a href="/explore" class="transition hover:text-neutral-300">Explorar</a>
<a href="/login" class="transition hover:text-neutral-300">Entrar</a> <a href="/login" data-sveltekit-reload class="transition hover:text-neutral-300">Entrar</a>
</div> </div>
</div> </div>
</footer> </footer>
+6 -1
View File
@@ -48,11 +48,16 @@
</button> </button>
</form> </form>
{:else} {:else}
<a href="/login" class="text-sm font-medium text-neutral-300 transition hover:text-white"> <a
href="/login"
data-sveltekit-reload
class="text-sm font-medium text-neutral-300 transition hover:text-white"
>
Iniciar sesión Iniciar sesión
</a> </a>
<a <a
href="/login?mode=register" href="/login?mode=register"
data-sveltekit-reload
class="rounded-full bg-emerald-500 px-4 py-2 text-sm font-semibold text-neutral-950 transition hover:bg-emerald-400" class="rounded-full bg-emerald-500 px-4 py-2 text-sm font-semibold text-neutral-950 transition hover:bg-emerald-400"
> >
Registrarse Registrarse
+2 -1
View File
@@ -45,7 +45,8 @@
<div class="mt-10 flex flex-wrap items-center justify-center gap-4"> <div class="mt-10 flex flex-wrap items-center justify-center gap-4">
<a <a
href="/login" href="/login?mode=register"
data-sveltekit-reload
class="rounded-full bg-emerald-500 px-6 py-3 text-sm font-semibold text-neutral-950 transition hover:bg-emerald-400" class="rounded-full bg-emerald-500 px-6 py-3 text-sm font-semibold text-neutral-950 transition hover:bg-emerald-400"
> >
Empezar gratis Empezar gratis
+1 -1
View File
@@ -16,7 +16,7 @@ export const GET: RequestHandler = async ({ url, cookies }) => {
const codeVerifier = cookies.get(VERIFIER_COOKIE); const codeVerifier = cookies.get(VERIFIER_COOKIE);
const state = cookies.get(STATE_COOKIE); const state = cookies.get(STATE_COOKIE);
const nonce = cookies.get(NONCE_COOKIE); const nonce = cookies.get(NONCE_COOKIE);
const returnTo = cookies.get(RETURN_COOKIE) ?? '/explore'; const returnTo = cookies.get(RETURN_COOKIE) ?? '/';
if (!codeVerifier || !state) { if (!codeVerifier || !state) {
error(400, 'Estado de autenticación inválido. Vuelve a iniciar sesión.'); error(400, 'Estado de autenticación inválido. Vuelve a iniciar sesión.');
+1 -1
View File
@@ -20,7 +20,7 @@ export const GET: RequestHandler = async ({ url, cookies }) => {
const nonce = client.randomNonce(); const nonce = client.randomNonce();
const register = url.searchParams.get('mode') === 'register'; const register = url.searchParams.get('mode') === 'register';
const returnTo = url.searchParams.get('returnTo') ?? '/explore'; const returnTo = url.searchParams.get('returnTo') ?? '/';
const parameters: Record<string, string> = { const parameters: Record<string, string> = {
redirect_uri: authConfig.redirectUri, redirect_uri: authConfig.redirectUri,