import { Alert, CircularProgress } from "@mui/material"; import Box from "@mui/material/Box"; import Button from "@mui/material/Button"; import Grid from "@mui/material/Grid"; import TextField from "@mui/material/TextField"; import Typography from "@mui/material/Typography"; import * as React from "react"; import { AuthApi } from "../../api/AuthApi"; import { ServerApi } from "../../api/ServerApi"; import { Link } from "react-router-dom"; /** * Login form */ export function LoginRoute(): React.ReactElement { const [loading, setLoading] = React.useState(false); const [error, setError] = React.useState(null); const handleSubmit = (event: React.FormEvent) => { event.preventDefault(); const data = new FormData(event.currentTarget); console.log({ email: data.get("email"), password: data.get("password"), }); }; const authWithProvider = async (id: string) => { try { setLoading(true); const res = await AuthApi.StartOpenIDLogin(id); window.location.href = res.url; } catch (e) { console.error(e); setError("Echec de l'initialisation de l'authentification OpenID !"); } }; if (loading) return ( <> ); return ( <> {error === null ? ( <> ) : ( {error} )} Connexion Mot de passe oublié {" "} Créer un nouveau compte
{ServerApi.Config.oidc_providers.map((p) => ( ))}
); }