mirror of
https://github.com/hex248/sprint.git
synced 2026-02-07 18:23:03 +00:00
converted login/register form to an actual html form
this allows the return key to submit the form easily
This commit is contained in:
@@ -136,8 +136,18 @@ export default function LogInForm() {
|
||||
setError("");
|
||||
};
|
||||
|
||||
const handleSubmit = (e: React.FormEvent) => {
|
||||
e.preventDefault();
|
||||
if (mode === "login") {
|
||||
logIn();
|
||||
} else {
|
||||
register();
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<div>
|
||||
<form onSubmit={handleSubmit}>
|
||||
<div
|
||||
className={cn(
|
||||
"flex flex-col gap-2 items-center border p-6 pb-4",
|
||||
@@ -179,12 +189,13 @@ export default function LogInForm() {
|
||||
|
||||
{mode === "login" ? (
|
||||
<>
|
||||
<Button variant={"outline"} onClick={logIn} type={"submit"}>
|
||||
<Button variant={"outline"} type={"submit"}>
|
||||
Log in
|
||||
</Button>
|
||||
<Button
|
||||
className="text-xs hover:underline p-0"
|
||||
variant={"dummy"}
|
||||
type="button"
|
||||
onClick={() => {
|
||||
setMode("register");
|
||||
resetForm();
|
||||
@@ -195,12 +206,13 @@ export default function LogInForm() {
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<Button variant={"outline"} onClick={register} type={"submit"}>
|
||||
<Button variant={"outline"} type={"submit"}>
|
||||
Register
|
||||
</Button>
|
||||
<Button
|
||||
className="text-xs hover:underline p-0"
|
||||
variant={"dummy"}
|
||||
type="button"
|
||||
onClick={() => {
|
||||
setMode("login");
|
||||
resetForm();
|
||||
@@ -211,6 +223,7 @@ export default function LogInForm() {
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
</form>
|
||||
<div className="flex items-end justify-end w-full text-xs -mb-4">
|
||||
{error !== "" ? (
|
||||
<Label className="text-destructive text-sm">{error}</Label>
|
||||
|
||||
Reference in New Issue
Block a user