From 6f228a598e5cf5c445dc255c608d3164b2a7b853 Mon Sep 17 00:00:00 2001 From: RonyVidaur Date: Sat, 3 Feb 2024 21:54:37 -0600 Subject: validate phone number based on country --- src/view/com/auth/create/Step2.tsx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/view/com/auth/create/Step2.tsx b/src/view/com/auth/create/Step2.tsx index 6005ee3a5..626ff0e86 100644 --- a/src/view/com/auth/create/Step2.tsx +++ b/src/view/com/auth/create/Step2.tsx @@ -42,10 +42,11 @@ export function Step2({ const {isMobile} = useWebMediaQueries() const onPressRequest = React.useCallback(() => { - if ( - uiState.verificationPhone.length >= 9 && - parsePhoneNumber(uiState.verificationPhone, uiState.phoneCountry) - ) { + const phoneNumber = parsePhoneNumber( + uiState.verificationPhone, + uiState.phoneCountry, + ); + if (phoneNumber.isValid()) { requestVerificationCode({uiState, uiDispatch, _}) } else { uiDispatch({ -- cgit 1.4.1 From 323b5bdfda426ac2f2366ff1f36031092f843e75 Mon Sep 17 00:00:00 2001 From: RonyVidaur Date: Sat, 3 Feb 2024 22:09:07 -0600 Subject: enhance check --- src/view/com/auth/create/Step2.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/view/com/auth/create/Step2.tsx b/src/view/com/auth/create/Step2.tsx index 626ff0e86..4e6512c9b 100644 --- a/src/view/com/auth/create/Step2.tsx +++ b/src/view/com/auth/create/Step2.tsx @@ -46,7 +46,7 @@ export function Step2({ uiState.verificationPhone, uiState.phoneCountry, ); - if (phoneNumber.isValid()) { + if (phoneNumber && phoneNumber.isValid()) { requestVerificationCode({uiState, uiDispatch, _}) } else { uiDispatch({ -- cgit 1.4.1 From 1412f9d95cfa5de31a80f279095618f84982705e Mon Sep 17 00:00:00 2001 From: RonyVidaur Date: Sat, 3 Feb 2024 22:27:50 -0600 Subject: format --- src/view/com/auth/create/Step2.tsx | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'src') diff --git a/src/view/com/auth/create/Step2.tsx b/src/view/com/auth/create/Step2.tsx index 4e6512c9b..c1648eccc 100644 --- a/src/view/com/auth/create/Step2.tsx +++ b/src/view/com/auth/create/Step2.tsx @@ -42,10 +42,7 @@ export function Step2({ const {isMobile} = useWebMediaQueries() const onPressRequest = React.useCallback(() => { - const phoneNumber = parsePhoneNumber( - uiState.verificationPhone, - uiState.phoneCountry, - ); + const phoneNumber = parsePhoneNumber(uiState.verificationPhone, uiState.phoneCountry) if (phoneNumber && phoneNumber.isValid()) { requestVerificationCode({uiState, uiDispatch, _}) } else { -- cgit 1.4.1