Login resuelto

This commit is contained in:
2026-02-27 09:16:08 -07:00
parent c146a6c3c3
commit 63925fe305
8 changed files with 109 additions and 11 deletions

View File

@@ -5,14 +5,24 @@
import { toast } from '$lib/stores/toast.js';
import { onMount } from 'svelte';
import { auth } from '$lib/stores/auth.js';
import { goto } from '$app/navigation';
import { page } from '$app/stores';
import { browser } from '$app/environment';
import '../app.css';
let sidebarOpen = false;
let mounted = false;
onMount(() => {
auth.init();
mounted = true;
});
// Guard reactivo global: redirige a /login si no está autenticado
$: if (browser && mounted && !$auth.isAuthenticated && $page.url.pathname !== '/login') {
goto('/login');
}
function toggleSidebar() {
sidebarOpen = !sidebarOpen;
}