diff --git a/components/sign-in.tsx b/components/sign-in.tsx index c31d84d..ef2f016 100644 --- a/components/sign-in.tsx +++ b/components/sign-in.tsx @@ -1,19 +1,25 @@ import Footer from "@/app/[locale]/(main)/footer" import Header from "@/app/[locale]/(main)/header" import { signIn } from "@/auth" +import { redirect } from "next/navigation" export function SignIn() { + async function handleSubmit(formData: FormData) { + 'use server' + try { + await signIn("credentials", formData) + } catch (error) { + redirect('/') + } + } + return (
{ - "use server" - const res = await signIn("credentials", formData) - console.log(res) - }} + action={handleSubmit} >
) -} \ No newline at end of file +}