From fc81d471ff1aa3a527c400f75481978a6a038238 Mon Sep 17 00:00:00 2001 From: smanylov Date: Thu, 29 Jan 2026 17:01:00 +0700 Subject: [PATCH] update accountType --- src/app/actions/auth.ts | 11 ++++++----- src/app/ui/forms/register-form.tsx | 20 ++++++++++---------- 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/src/app/actions/auth.ts b/src/app/actions/auth.ts index 9a639d6..0b6439d 100644 --- a/src/app/actions/auth.ts +++ b/src/app/actions/auth.ts @@ -146,9 +146,9 @@ export async function registration( state: FormState | undefined, formData: FormData, ): Promise { - const registrationType = formData.get('accoutType') as string || ''; + const accountType = formData.get('accountType') as string || ''; - console.log(registrationType); + console.log(accountType); const fullName = formData.get('fullName') as string || ''; const email = formData.get('email') as string || ''; @@ -167,7 +167,7 @@ export async function registration( password, confirm_password, agree, - ...(registrationType === 'btb' && { companyName }) + ...(accountType === 'btb' && { companyName }) }; const validatedFields = SignupFormSchema.safeParse(dataToValidate); @@ -193,7 +193,7 @@ export async function registration( confirm_password, phone, agree, - ...(registrationType === 'btb' && { companyName }) + ...(accountType === 'btb' && { companyName }) }, error: errors }; @@ -211,7 +211,8 @@ export async function registration( email, phone: phone, password, - ...(registrationType === 'btb' && { companyName: companyName }) + accountType, + ...(accountType === 'btb' && { companyName: companyName }) } }), headers: { diff --git a/src/app/ui/forms/register-form.tsx b/src/app/ui/forms/register-form.tsx index e68a4c4..a705888 100644 --- a/src/app/ui/forms/register-form.tsx +++ b/src/app/ui/forms/register-form.tsx @@ -27,7 +27,7 @@ export default function RegisterForm() { const [formState, setFormState] = useState(undefined); const [showMailConfirmWindow, setShowMailConfirmWindow] = useState(false); const passwordRef = useRef(null); - const [accountType, setAccountType] = useState<'btc' | 'btb'>('btc'); + const [accountType, setAccountType] = useState<'b2c' | 'b2b'>('b2c'); useEffect(() => { setFormState(state); @@ -114,10 +114,10 @@ export default function RegisterForm() { } } - function switchRegistrationTypeHandler(e: React.MouseEvent, type: 'btc' | 'btb') { + function switchRegistrationTypeHandler(e: React.MouseEvent, type: 'b2c' | 'b2b') { e.preventDefault(); setAccountType(type); - if (formState && type === 'btc') { + if (formState && type === 'b2c') { setFormState({ ...formState, previousState: { @@ -184,25 +184,25 @@ export default function RegisterForm() { }}>
@@ -239,7 +239,7 @@ export default function RegisterForm() { )}
- {accountType === 'btb' && ( + {accountType === 'b2b' && (