From db14907a2a3054aff1b4e85e042925a7c0f44ad8 Mon Sep 17 00:00:00 2001 From: "Builder.io" Date: Sat, 27 Sep 2025 20:19:01 +0000 Subject: [PATCH] Route users through onboarding and finalize profile; replace placeholders with full pages cgen-b0a06a29a635458ba758b8f3b9b25372 --- client/pages/Login.tsx | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/client/pages/Login.tsx b/client/pages/Login.tsx index 00e27ed2..4d3479db 100644 --- a/client/pages/Login.tsx +++ b/client/pages/Login.tsx @@ -33,15 +33,19 @@ export default function Login() { const [password, setPassword] = useState(""); const [fullName, setFullName] = useState(""); const navigate = useNavigate(); - const { signIn, signUp, signInWithOAuth, user, loading } = useAuth(); + const { signIn, signUp, signInWithOAuth, user, loading, profile } = useAuth(); const { success: toastSuccess, error: toastError } = useAethexToast(); // Redirect if already logged in useEffect(() => { if (user && !loading) { - navigate("/dashboard"); + if (profile) { + navigate("/dashboard", { replace: true }); + } else { + navigate("/onboarding", { replace: true }); + } } - }, [user, loading, navigate]); + }, [user, profile, loading, navigate]); const handleSubmit = async (e: React.FormEvent) => { e.preventDefault(); @@ -63,7 +67,7 @@ export default function Login() { setIsSignUp(false); } else { await signIn(email, password); - navigate("/dashboard"); + // Navigation is handled by the auth redirect effect based on profile existence } } catch (error: any) { console.error("Authentication error:", error);