import axios from "axios"; import { useEffect, useState } from "react"; const INIT_USER = { name: "", idNumber1: "", idNumber2: "", email: "", password: "", checkpw: "", phone: "", }; const Signup = () => { const [user, setUser] = useState(INIT_USER); const [error, setError] = useState(""); const [disabled, setDisabled] = useState(false); const [success, setSuccess] = useState(false); useEffect(() => { setDisabled( !( user.name && user.idNumber1 && user.idNumber2 && user.email && user.password && user.checkpw ) ); }, [user]); function handleChange(event) { const { name, value } = event.target; setUser({ ...user, [name]: value }); console.log(user); } async function handleSubmit() { try { const data = await axios.post("https://localhost:8080/api/room/1/1",user) // setLoading(true); // setError(""); // const success = await login(user.email, user.password); console.log(data); setSuccess(success); } catch (error) { // catchErrors(error, setError); } finally { // setLoading(false); } } const { name, idNumber1, idNumber2, id, password, checkpw, phone } = user; return (
회원가입
* * * * * *
{console.log(disabled)}
); }; export default Signup;