Add user login, signup, and session.
This commit is contained in:
parent
3be05a9752
commit
f5466faa70
6 changed files with 101 additions and 36 deletions
|
|
@ -1,7 +1,24 @@
|
|||
import UnderConstruction from "@/components/static_pages/UnderConstruction";
|
||||
import { useState } from "react";
|
||||
|
||||
import { login, signup } from "@/lib/server_functions/userAuth";
|
||||
export default function Login() {
|
||||
const [createAccount, setCreateAccount] = useState(false);
|
||||
|
||||
return (
|
||||
<UnderConstruction />
|
||||
)
|
||||
}
|
||||
<div>
|
||||
<form action={createAccount ? login : signup}>
|
||||
<input type="text" name="username" placeholder="Username" required />
|
||||
<input
|
||||
type="password"
|
||||
name="password"
|
||||
placeholder="Password"
|
||||
required
|
||||
/>
|
||||
<button type="submit">{createAccount ? "Login" : "Signup"}</button>
|
||||
</form>
|
||||
<button onClick={() => setCreateAccount(!createAccount)}>
|
||||
{createAccount ? "Don't have an account?" : "Already have an account?"}
|
||||
</button>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue