From 490388360a0852bcf8ee054e96fa90e166df5792 Mon Sep 17 00:00:00 2001 From: polwex Date: Thu, 29 May 2025 14:52:38 +0700 Subject: fucker actually solved the cookies, love ya man --- src/components/Login2.tsx | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'src/components/Login2.tsx') diff --git a/src/components/Login2.tsx b/src/components/Login2.tsx index 6c26efc..7adf09c 100644 --- a/src/components/Login2.tsx +++ b/src/components/Login2.tsx @@ -42,17 +42,18 @@ function OOldform({ isReg, toggle }: { isReg: boolean; toggle: () => void }) { else setStrings(logstrings); }, [isReg]); - // const [state, formAction, isPending] = useActionState( - // isReg ? postRegister : postLogin, - // { error: "" }, - // "/login", - // ); const [state, formAction, isPending] = useActionState( - postLogin, + isReg ? postRegister : postLogin, { error: "" }, "/login", ); console.log({ state }); + + // Handle redirect after successful login + if (state.success && state.redirect) { + window.location.href = state.redirect; + } + return (
@@ -87,8 +88,8 @@ function OOldform({ isReg, toggle }: { isReg: boolean; toggle: () => void }) { {state.password &&

{state.password}

}
-
{strings.toggle} @@ -101,7 +102,8 @@ function OOldform({ isReg, toggle }: { isReg: boolean; toggle: () => void }) {
- {state.error &&

{state.error}

} + {state.error &&

{state.error}

} + {state.success &&

Login successful! Redirecting...

}
-- cgit v1.2.3