Skip to content

Commit

Permalink
upload
Browse files Browse the repository at this point in the history
  • Loading branch information
JadeMin committed Jun 24, 2024
1 parent b3a6487 commit ea81268
Showing 1 changed file with 25 additions and 19 deletions.
44 changes: 25 additions & 19 deletions src/app/register/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,24 @@ import Footer from "@/app/components/footer";
import "./page.css";

export default function Login() {
const [id, setId] = useState("");
const [password, setPassword] = useState("");
const [passwordCheck, setPasswordCheck] = useState("");
const [studentId, setStudentId] = useState("");
const [agree, setAgree] = useState(false);
const [error, setError] = useState(true);

const requiredInputs = [id, password, passwordCheck, studentId];

useEffect(() => {
if (password === passwordCheck && agree === true) {
setError(false);
} else {
setError(true);
if (!requiredInputs.some(i => i.length === 0)) {
if(password === passwordCheck && agree === true) {
return setError(false);
}
}
}, [password, passwordCheck, agree]);

setError(true);
}, requiredInputs);


return (
Expand All @@ -33,33 +39,33 @@ export default function Login() {
method="post"
onSubmit={e => e.preventDefault()}
>
<input
type="number"
placeholder="학번 (필수)"
required={true}
value={studentId}
onChange={e => setStudentId(e.target.value)}
/>
<input
type="text"
placeholder="아이디"
placeholder="아이디 (필수)"
required={true}
value={id}
onChange={e => setId(e.target.value)}
/>
<input
type="password"
placeholder="비밀번호"
placeholder="비밀번호 (필수)"
required={true}
value={password}
onChange={e => {
setPassword(e.target.value);
}}
onChange={e => setPassword(e.target.value)}
/>
<input
type="password"
placeholder="비밀번호 확인"
placeholder="비밀번호 확인 (필수)"
required={true}
value={passwordCheck}
onChange={e => {
setPasswordCheck(e.target.value);
}}
/>
<input
type="number"
placeholder="학번"
required={true}
onChange={e => setPasswordCheck(e.target.value)}
/>
<input
type="email"
Expand Down

0 comments on commit ea81268

Please sign in to comment.