mirror of
https://github.com/LukeHagar/better-auth.git
synced 2025-12-09 20:27:44 +00:00
fix: additional fields default values not being applied (#663)
This commit is contained in:
@@ -1,18 +0,0 @@
|
||||
"use server";
|
||||
|
||||
import { auth } from "@/lib/auth";
|
||||
|
||||
export const singInAction = async (previousState: any, data: FormData) => {
|
||||
const email = data.get("email")?.toString();
|
||||
const password = data.get("password")?.toString();
|
||||
if (!email || !password) {
|
||||
return null;
|
||||
}
|
||||
const res = await auth.api.signInEmail({
|
||||
body: {
|
||||
email,
|
||||
password,
|
||||
},
|
||||
});
|
||||
return res;
|
||||
};
|
||||
@@ -1,26 +0,0 @@
|
||||
"use client";
|
||||
|
||||
import { useActionState } from "react";
|
||||
import { auth } from "@/lib/auth";
|
||||
import { singInAction } from "./action";
|
||||
import { Input } from "@/components/ui/input";
|
||||
import { Button } from "@/components/ui/button";
|
||||
|
||||
export default function SignInForm() {
|
||||
const [state, action, isPending] = useActionState(singInAction, null);
|
||||
return (
|
||||
<form action={action}>
|
||||
<div>
|
||||
<Input type="email" name="email" placeholder="Email" />
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<Input type="password" name="password" placeholder="Password" />
|
||||
</div>
|
||||
|
||||
<Button type="submit" disabled={isPending}>
|
||||
{isPending ? "Logging in..." : "Log in"}
|
||||
</Button>
|
||||
</form>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user