Create account page now has form

This commit is contained in:
Ava DeCroix
2023-04-27 14:40:49 -04:00
parent 38e5d82a13
commit 940fc164cf
2 changed files with 36 additions and 1 deletions

View File

@@ -3,12 +3,45 @@ import {Routes, Route, useNavigate} from 'react-router-dom';
import './Login.css';
function CreateAccount() {
const navigate = useNavigate();
const navigateLogin = () => {
navigate('/');
}
const [data,setData] = useState({
username:"",
password:"",
email:"",
})
const {username,password,email} = data;
const changeHandler = e => {
setData({...data,[e.target.name]:[e.target.value]});
}
const submitHandler = e => {
e.preventDefault();
console.log(data);
}
return (
<div>
<center>
<h1>Create Account</h1>
<p>Enter your account information</p>
<form onSubmit={submitHandler}>
<p>Username:</p>
<input type="text" name="username" value={username} onChange={changeHandler}/><br/>
<p>Password:</p>
<input type="password" name="password" value={password} onChange={changeHandler}/><br/>
<p>Email:</p>
<input type="email" name="email" value={email} onChange={changeHandler}/><br/>
<input type="submit" name="submit"/>
</form>
</center>
</div>

View File

@@ -31,7 +31,9 @@ function Login() {
<h1>Log In</h1>
<p>Log in to your account</p>
<form onSubmit={submitHandler}>
<input type="text" name="username" value={username} onChange={changeHandler}/><br/>
<p>Username:</p>
<input type="text" name="username" value={username} onChange={changeHandler}/>
<p>Password:</p>
<input type="password" name="password" value={password} onChange={changeHandler}/><br/>
<input type="submit" name="submit"/>
</form>