From 27d61f6174512c1fe9d08e3e0f5a12d3900c0308 Mon Sep 17 00:00:00 2001 From: hamster1963 <1410514192@qq.com> Date: Sun, 20 Oct 2024 23:27:54 +0800 Subject: [PATCH] fix: login state --- components/sign-in.tsx | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) 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 (