completionId: cgen-8b52cb96c706478998f4933a5e9c328d

cgen-8b52cb96c706478998f4933a5e9c328d
This commit is contained in:
Builder.io 2025-11-16 08:41:20 +00:00
parent 64149944e3
commit 72f0b23041

View file

@ -134,10 +134,14 @@ export default function Login() {
// Check if there's an OAuth redirect destination stored (e.g., from staff login)
const oauthRedirect = sessionStorage.getItem("oauth_redirect_to");
// New logic: if profile exists (even if incomplete), go to Dashboard
// Otherwise send to Onboarding for new users
const profileExists = profile !== null;
const redirectDest =
(next && next.startsWith("/") ? next : null) ||
oauthRedirect ||
(profileComplete ? "/dashboard" : "/onboarding");
(profileExists ? "/dashboard" : "/onboarding");
// Clear the stored redirect after using it
if (oauthRedirect) {
@ -148,7 +152,7 @@ export default function Login() {
replace: true,
});
}
}, [user, loading, profileComplete, navigate, location.search]);
}, [user, profile, loading, navigate, location.search]);
// Pre-fill email if Discord was just linked
useEffect(() => {