-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Ishaan Upadhyay <[email protected]>
- Loading branch information
1 parent
13fc486
commit cfcff43
Showing
2 changed files
with
58 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,57 @@ | ||
"use client" | ||
|
||
import Image from "next/image" | ||
import { client } from "../../lib/db" | ||
|
||
export default async function SignUp() { | ||
return <div> | ||
<h1> hello </h1> | ||
</div>; | ||
} | ||
import { useState, FormEvent } from 'react'; | ||
|
||
const Signup = (): JSX.Element => { | ||
const [name, setName] = useState<string>(''); | ||
const [email, setEmail] = useState<string>(''); | ||
const [password, setPassword] = useState<string>(''); | ||
|
||
const handleSubmit = async (e: FormEvent<HTMLFormElement>) => { | ||
e.preventDefault(); | ||
|
||
// Handle form submission here | ||
const res = await fetch('/api/users', { | ||
method: 'POST', | ||
body: JSON.stringify({"username": name}), | ||
}); | ||
console.log(res); | ||
}; | ||
|
||
return ( | ||
<div> | ||
<h1>Sign Up</h1> | ||
<form onSubmit={handleSubmit}> | ||
<div> | ||
<label>Name:</label> | ||
<input | ||
type="text" | ||
value={name} | ||
onChange={(e) => setName(e.target.value)} | ||
/> | ||
</div> | ||
<div> | ||
<label>Email:</label> | ||
<input | ||
type="email" | ||
value={email} | ||
onChange={(e) => setEmail(e.target.value)} | ||
/> | ||
</div> | ||
<div> | ||
<label>Password:</label> | ||
<input | ||
type="password" | ||
value={password} | ||
onChange={(e) => setPassword(e.target.value)} | ||
/> | ||
</div> | ||
<button type="submit">Sign Up</button> | ||
</form> | ||
</div> | ||
); | ||
}; | ||
|
||
export default Signup; |