suppression du raccourci

This commit is contained in:
ORDONNEAU Antoine
2026-03-12 11:38:23 +01:00
parent 6fb97ddaf7
commit 7f3100678e
@@ -1,4 +1,4 @@
import {useState, useContext, useEffect} from "react";
import { useState, useContext } from "react";
import styles from "./loginForm.module.css";
import Button from "../../../../components/ui/button/button.tsx";
import Input from "../../../../components/ui/input/input.tsx";
@@ -9,32 +9,17 @@ import { AuthContext } from "../../../../contexts/auth/AuthContext.js";
function LoginForm({ className }) {
const navigate = useNavigate();
const { login } = useContext(AuthContext);
const [email, setEmail] = useState('');
const [password, setPassword] = useState('');
const [open , setOpen] = useState(false);
const handleSubmit = async () => {
async function handleSubmit() {
const res = await login(email, password);
if (res.status === 401 || res.status === 422) setOpen(true);
else navigate("/");
};
useEffect(() => {
const listener = (e) => {
if (e.key === "Enter") {
handleSubmit();
}
};
window.addEventListener("keydown", listener);
return () => {
window.removeEventListener("keydown", listener);
};
},);
}
return (
<div className={`${className} glassCard ${styles.inputContainer}`}>