Route new users to onboarding from login
cgen-4321c29aed0542c493d956323c13deca
This commit is contained in:
parent
4cd9dd7d35
commit
3abcfa6cf9
1 changed files with 7 additions and 4 deletions
|
|
@ -34,15 +34,18 @@ export default function Login() {
|
|||
const [password, setPassword] = useState("");
|
||||
const [fullName, setFullName] = useState("");
|
||||
const navigate = useNavigate();
|
||||
const { signIn, signUp, signInWithOAuth, user, loading, profile } = useAuth();
|
||||
const { signIn, signUp, signInWithOAuth, user, loading, profileComplete } =
|
||||
useAuth();
|
||||
const { success: toastSuccess, error: toastError } = useAethexToast();
|
||||
|
||||
// After auth resolves and a user exists, navigate to dashboard
|
||||
useEffect(() => {
|
||||
if (user && !loading) {
|
||||
navigate("/dashboard", { replace: true });
|
||||
if (!loading && user) {
|
||||
navigate(profileComplete ? "/dashboard" : "/onboarding", {
|
||||
replace: true,
|
||||
});
|
||||
}
|
||||
}, [user, loading, navigate]);
|
||||
}, [user, loading, profileComplete, navigate]);
|
||||
|
||||
const handleSubmit = async (e: React.FormEvent) => {
|
||||
e.preventDefault();
|
||||
|
|
|
|||
Loading…
Reference in a new issue