diff options
author | Hailey <me@haileyok.com> | 2024-08-28 11:56:04 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-08-28 11:56:04 -0700 |
commit | 16d556c3c9f825303be5aa27ab55dd6d386053aa (patch) | |
tree | 4049bf84953f353eaa4c795da9d2961005dd412b /src/screens/Signup/state.ts | |
parent | 94d2180aaafd2146ee2eae51895a4947311a1c51 (diff) | |
download | voidsky-16d556c3c9f825303be5aa27ab55dd6d386053aa.tar.zst |
Ensure captcha verification code gets submitted in signup request (#5010)
Co-authored-by: Eric Bailey <git@esb.lol>
Diffstat (limited to 'src/screens/Signup/state.ts')
-rw-r--r-- | src/screens/Signup/state.ts | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/src/screens/Signup/state.ts b/src/screens/Signup/state.ts index 0ee266564..4addf3580 100644 --- a/src/screens/Signup/state.ts +++ b/src/screens/Signup/state.ts @@ -27,7 +27,7 @@ export enum SignupStep { } type SubmitTask = { - code: string | undefined + verificationCode: string | undefined mutableProcessed: boolean // OK to mutate assuming it's never read in render. } @@ -62,7 +62,6 @@ export type SignupAction = | {type: 'setDateOfBirth'; value: Date} | {type: 'setInviteCode'; value: string} | {type: 'setHandle'; value: string} - | {type: 'setVerificationCode'; value: string} | {type: 'setError'; value: string} | {type: 'setIsLoading'; value: boolean} | {type: 'submit'; task: SubmitTask} @@ -189,11 +188,7 @@ export function useSubmitSignup() { const onboardingDispatch = useOnboardingDispatch() return useCallback( - async ( - state: SignupState, - dispatch: (action: SignupAction) => void, - verificationCode?: string, - ) => { + async (state: SignupState, dispatch: (action: SignupAction) => void) => { if (!state.email) { dispatch({type: 'setStep', value: SignupStep.INFO}) return dispatch({ @@ -224,7 +219,7 @@ export function useSubmitSignup() { } if ( state.serviceDescription?.phoneVerificationRequired && - !verificationCode + !state.pendingSubmit?.verificationCode ) { dispatch({type: 'setStep', value: SignupStep.CAPTCHA}) logger.error('Signup Flow Error', { @@ -247,7 +242,7 @@ export function useSubmitSignup() { password: state.password, birthDate: state.dateOfBirth, inviteCode: state.inviteCode.trim(), - verificationCode: verificationCode, + verificationCode: state.pendingSubmit?.verificationCode, }) /* * Must happen last so that if the user has multiple tabs open and |