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:
@@ -5,7 +5,7 @@
|
||||
<p>© {new Date().getFullYear()} Musify · Streaming de música.</p>
|
||||
<div class="flex gap-6">
|
||||
<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>
|
||||
</footer>
|
||||
|
||||
@@ -48,11 +48,16 @@
|
||||
</button>
|
||||
</form>
|
||||
{: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
|
||||
</a>
|
||||
<a
|
||||
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"
|
||||
>
|
||||
Registrarse
|
||||
|
||||
@@ -45,7 +45,8 @@
|
||||
|
||||
<div class="mt-10 flex flex-wrap items-center justify-center gap-4">
|
||||
<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"
|
||||
>
|
||||
Empezar gratis
|
||||
|
||||
@@ -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.');
|
||||
|
||||
@@ -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<string, string> = {
|
||||
redirect_uri: authConfig.redirectUri,
|
||||
|
||||
Reference in New Issue
Block a user