diff --git a/webapp/src/components/wrappers/LoginWrapper.tsx b/webapp/src/components/wrappers/LoginWrapper.tsx index 77fa54a626..c03c079109 100644 --- a/webapp/src/components/wrappers/LoginWrapper.tsx +++ b/webapp/src/components/wrappers/LoginWrapper.tsx @@ -1,7 +1,6 @@ -import { useState } from "react"; import { Box, Typography } from "@mui/material"; import { useTranslation } from "react-i18next"; -import { LoadingButton } from "@mui/lab"; +import LoginIcon from "@mui/icons-material/Login"; import { login } from "../../redux/ducks/auth"; import logo from "../../assets/logo.png"; import topRightBackground from "../../assets/top-right-background.png"; @@ -30,7 +29,6 @@ interface Props { function LoginWrapper(props: Props) { const { children } = props; - const [loginError, setLoginError] = useState(""); const { t } = useTranslation(); const user = useAppSelector(getAuthUser); const dispatch = useAppDispatch(); @@ -62,18 +60,8 @@ function LoginWrapper(props: Props) { // Event Handlers //////////////////////////////////////////////////////////////// - const handleSubmit = async (data: SubmitHandlerPlus) => { - const { values } = data; - - setLoginError(""); - - try { - await dispatch(login(values)).unwrap(); - } catch (err) { - // eslint-disable-next-line @typescript-eslint/no-explicit-any - setLoginError((err as any).data?.message || t("login.error")); - throw err; - } + const handleSubmit = ({ values }: SubmitHandlerPlus) => { + return dispatch(login(values)).unwrap(); }; //////////////////////////////////////////////////////////////// @@ -150,47 +138,43 @@ function LoginWrapper(props: Props) { -
- {({ control, formState: { isDirty, isSubmitting } }) => ( + } + sx={{ + ".Form__Footer": { + justifyContent: "center", + }, + }} + > + {({ control }) => ( <> - {loginError && ( - - {loginError} - - )} - - - {t("global.connexion")} - - )}