@@ -27,7 +27,7 @@ export enum SignupStep {
27
27
}
28
28
29
29
type SubmitTask = {
30
- code : string | undefined
30
+ verificationCode : string | undefined
31
31
mutableProcessed : boolean // OK to mutate assuming it's never read in render.
32
32
}
33
33
@@ -62,7 +62,6 @@ export type SignupAction =
62
62
| { type : 'setDateOfBirth' ; value : Date }
63
63
| { type : 'setInviteCode' ; value : string }
64
64
| { type : 'setHandle' ; value : string }
65
- | { type : 'setVerificationCode' ; value : string }
66
65
| { type : 'setError' ; value : string }
67
66
| { type : 'setIsLoading' ; value : boolean }
68
67
| { type : 'submit' ; task : SubmitTask }
@@ -189,11 +188,7 @@ export function useSubmitSignup() {
189
188
const onboardingDispatch = useOnboardingDispatch ( )
190
189
191
190
return useCallback (
192
- async (
193
- state : SignupState ,
194
- dispatch : ( action : SignupAction ) => void ,
195
- verificationCode ?: string ,
196
- ) => {
191
+ async ( state : SignupState , dispatch : ( action : SignupAction ) => void ) => {
197
192
if ( ! state . email ) {
198
193
dispatch ( { type : 'setStep' , value : SignupStep . INFO } )
199
194
return dispatch ( {
@@ -224,7 +219,7 @@ export function useSubmitSignup() {
224
219
}
225
220
if (
226
221
state . serviceDescription ?. phoneVerificationRequired &&
227
- ! verificationCode
222
+ ! state . pendingSubmit ?. verificationCode
228
223
) {
229
224
dispatch ( { type : 'setStep' , value : SignupStep . CAPTCHA } )
230
225
logger . error ( 'Signup Flow Error' , {
@@ -247,7 +242,7 @@ export function useSubmitSignup() {
247
242
password : state . password ,
248
243
birthDate : state . dateOfBirth ,
249
244
inviteCode : state . inviteCode . trim ( ) ,
250
- verificationCode : verificationCode ,
245
+ verificationCode : state . pendingSubmit ?. verificationCode ,
251
246
} )
252
247
/*
253
248
* Must happen last so that if the user has multiple tabs open and
0 commit comments