import { createFileRoute, redirect } from "@tanstack/react-router"; import { authStore } from "@/lib/auth"; /** * "/" — pas d'UI propre, juste un router. * * Décision actuelle : * - non authentifié → /login * - authentifié → /onboarding/compte (placeholder tant que le layout * `_app` et le dashboard n'existent pas) * * Quand le layout `_app` arrivera, on enverra plutôt vers / côté `_app`, * qui lui-même décidera entre dashboard et onboarding selon * `organization.onboardingCompletedAt`. */ export const Route = createFileRoute("/")({ beforeLoad: () => { if (!authStore.isAuthenticated()) { throw redirect({ to: "/login" }); } throw redirect({ to: "/onboarding/compte" }); }, });