completionId: cgen-fdc1a19948304a6f80bbab5ea09e34e1

cgen-fdc1a19948304a6f80bbab5ea09e34e1
This commit is contained in:
Builder.io 2025-11-17 02:50:54 +00:00
parent bdf45b1874
commit 1d84caf98b

View file

@ -316,8 +316,18 @@ export default function Onboarding() {
user.email?.split("@")[0] ||
"user";
const normalizedLast = data.personalInfo.lastName?.trim() || "";
// Use username from form if provided, otherwise generate from first name
const usernameFromForm = data.username?.trim().toLowerCase();
const generatedUsername = normalizedFirst.replace(/\s+/g, "_").toLowerCase();
const finalUsername = usernameFromForm || generatedUsername;
if (!finalUsername) {
throw new Error("Username is required to complete profile setup");
}
const payload = {
username: normalizedFirst.replace(/\s+/g, "_"),
username: finalUsername,
full_name: `${normalizedFirst} ${normalizedLast}`.trim(),
user_type:
(userTypeMap[data.userType || "member"] as any) || "game_developer",