From 3e63146a43c82abb578dae34dba6ba51fe3f3e27 Mon Sep 17 00:00:00 2001 From: Gaurika Mahajan Date: Sun, 28 Jul 2024 22:39:05 -0400 Subject: [PATCH] fixing some backend tests and validation --- .../ProfileEditUnregistered.jsx | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/client/src/pages/ProfileEditUnregistered/ProfileEditUnregistered.jsx b/client/src/pages/ProfileEditUnregistered/ProfileEditUnregistered.jsx index c10aeec7..ca5a23a5 100644 --- a/client/src/pages/ProfileEditUnregistered/ProfileEditUnregistered.jsx +++ b/client/src/pages/ProfileEditUnregistered/ProfileEditUnregistered.jsx @@ -124,10 +124,7 @@ const PageProfileEditUnregistered = () => { errorsCopy['phoneNumber'] = 'Please enter a phone number'; anyErrorsNow = true; } - if (accountObj['phoneNumberCountryCode'] === undefined || accountObj['phoneNumberCountryCode'] === '') { - errorsCopy['phoneNumberCountryCode'] = 'Please enter a country code'; - anyErrorsNow = true; - } else if (!/^[+0-9]*$/.test(accountObj['phoneNumberCountryCode'])) { + if (!/^[+0-9]*$/.test(accountObj['phoneNumberCountryCode'])) { errorsCopy['phoneNumberCountryCode'] = 'Must contain characters 0-9 or +'; anyErrorsNow = true; } else if (accountObj['phoneNumberCountryCode'].length > 4) { @@ -138,21 +135,15 @@ const PageProfileEditUnregistered = () => { errorsCopy['emergencyContactName'] = 'Please try to use 50 characters or less'; anyErrorsNow = true; } - if (accountObj['emergencyContactRelationship'] === undefined || accountObj['emergencyContactRelationship'] === '') { - errorsCopy['emergencyContactRelationship'] = 'Please enter an emergency contact relationship'; - anyErrorsNow = true; - } else if (accountObj['emergencyContactName'].length > 50) { - errorsCopy['emergencyContactName'] = 'Please try to use 50 characters or less'; + if (accountObj['emergencyContactRelationship'].length > 50) { + errorsCopy['emergencyContactRelationship'] = 'Please try to use 50 characters or less'; anyErrorsNow = true; } if (accountObj['emergencyContactNumber'] === undefined || accountObj['emergencyContactNumber'] === '') { errorsCopy['emergencyContactNumber'] = 'Please enter a phone number'; anyErrorsNow = true; } - if (accountObj['emergencyContactCountryCode'] === undefined || accountObj['emergencyContactCountryCode'] === '') { - errorsCopy['emergencyContactCountryCode'] = 'Please enter a country code'; - anyErrorsNow = true; - } else if (!/^[+0-9]*$/.test(accountObj['emergencyContactCountryCode'])) { + if (!/^[+0-9]*$/.test(accountObj['emergencyContactCountryCode'])) { errorsCopy['emergencyContactCountryCode'] = 'Must contain characters 0-9 or +'; anyErrorsNow = true; } else if (accountObj['emergencyContactCountryCode'].length > 4) {