import { useLocation } from "wouter"; import { useAuth } from "@/_core/hooks/useAuth"; import { Button } from "@/components/ui/button"; import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card"; import { APP_LOGO, APP_TITLE, getLoginUrl } from "@/const"; import { KeyRound, Shield } from "lucide-react"; import { useEffect } from "react"; export default function LoginChoice() { const [, setLocation] = useLocation(); const { user, loading, isAuthenticated } = useAuth(); // Rediriger les utilisateurs déjà connectés vers le tableau de bord useEffect(() => { if (!loading && isAuthenticated && user?.role === 'admin') { setLocation('/admin'); } }, [loading, isAuthenticated, user?.role, setLocation]); const handleManusLogin = () => { window.location.href = getLoginUrl(); }; const handleLocalLogin = () => { setLocation("/login"); }; // Afficher un loader pendant la vérification de l'authentification if (loading) { return (
Vous n'avez pas de compte ?
Contactez l'administrateur