feat: Implement dedicated login page and public/dashboard layouts, refactoring authentication flow and removing the todos page.
This commit is contained in:
@@ -6,7 +6,6 @@
|
||||
import { resolve } from '$app/paths';
|
||||
import { UserPlus, Mail, Clock, Award, TrendingUp, Zap, Users, Database } from 'lucide-svelte';
|
||||
import ProtectedRoute from '$lib/components/ProtectedRoute.svelte';
|
||||
import { loginModalStore } from '$lib/stores/loginModal.svelte';
|
||||
|
||||
// Queries para dados do dashboard
|
||||
const statsQuery = useQuery(api.dashboard.getStats, {});
|
||||
@@ -36,7 +35,12 @@
|
||||
|
||||
// Se for erro de autenticação, abrir modal de login automaticamente
|
||||
if (error === 'auth_required') {
|
||||
loginModalStore.open(route || to.url.pathname);
|
||||
const redirectTo = route || to.url.pathname;
|
||||
goto(`${resolve('/login')}?redirect=${encodeURIComponent(redirectTo)}`, {
|
||||
replaceState: true,
|
||||
noScroll: true
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
// Limpar URL usando SvelteKit (após router estar inicializado)
|
||||
@@ -65,7 +69,12 @@
|
||||
const route = urlParams.get('route') || urlParams.get('redirect') || '';
|
||||
|
||||
if (error === 'auth_required') {
|
||||
loginModalStore.open(route || window.location.pathname);
|
||||
const redirectTo = route || window.location.pathname;
|
||||
goto(`${resolve('/login')}?redirect=${encodeURIComponent(redirectTo)}`, {
|
||||
replaceState: true,
|
||||
noScroll: true
|
||||
});
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user