Fakultas Ilmu Komputer UI

Commit 4b05d8ee authored by FadhilP's avatar FadhilP
Browse files

remove unecessary variables

parent b1a5668d
......@@ -22,7 +22,7 @@ export default function LoginForm(props){
window.location.reload()
}
catch(error) {
setMessage('Error')
setMessage('Login failed')
resetPassword()
resetUsername()
}
......
......@@ -10,7 +10,6 @@ export default function RegisterForm(props){
const { value: username, bind: bindUsername, reset: resetUsername } = useInput('')
const { value: password, bind: bindPassword, reset: resetPassword } = useInput('')
const { value: email, bind: bindEmail, reset: resetEmail } = useInput('')
const [successful, setSuccesful] = useState(false)
const [message, setMessage] = useState('')
const handleRegister = async event => {
......@@ -25,10 +24,7 @@ export default function RegisterForm(props){
window.location.reload()
}
catch(error){
const responseMessage =
(error.response && error.response.data && error.response.data.message) || error.message || error.toString()
setMessage(responseMessage)
setSuccesful(false)
setMessage('Register failed')
resetPassword()
resetUsername()
resetEmail()
......@@ -39,42 +35,42 @@ export default function RegisterForm(props){
<div className="formContainer">
<h1>Register</h1>
<form onSubmit={handleRegister}>
{!successful && (
<div className="register_form-container">
<label htmlFor='username'>Username</label>
<input
type='text'
name='username'
className="username"
{...bindUsername}
required
placeholder="Your username"
/>
<div className="register_form-container">
<label htmlFor='username'>Username</label>
<input
type='text'
name='username'
className="username"
{...bindUsername}
required
placeholder="Your username"
/>
<label htmlFor='email'>Email</label>
<input
type='text'
name='email'
className="email"
{...bindEmail}
required
placeholder="Your email"
/>
<label htmlFor='email'>Email</label>
<input
type='text'
name='email'
className="email"
{...bindEmail}
required
placeholder="Your email"
/>
<label htmlFor='password'>Password</label>
<input
type='password'
name='password'
className="password"
{...bindPassword}
required
placeholder="password"
/>
<div className="buttonContainer">
<button className='registerButton'>Sign Up</button>
</div>
<label htmlFor='password'>Password</label>
<input
type='password'
name='password'
className="password"
{...bindPassword}
required
placeholder="password"
/>
<div className="buttonContainer">
<button className='registerButton'>Sign Up</button>
</div>
)}
</div>
{message && (
<div>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment