Skip to content

Commit

Permalink
Merge pull request Expensify#23141 from GItGudRatio/fix/22819-multipl…
Browse files Browse the repository at this point in the history
…e-errors

fix: ensure multiple errors are not shown on Add New contact page
  • Loading branch information
jasperhuangg authored Jul 21, 2023
2 parents 7fea760 + b80958f commit eebb9e1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/pages/settings/Profile/Contacts/NewContactMethodPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ const getPhoneLogin = (phoneOrEmail) => {
const validateNumber = (values) => {
const parsedPhoneNumber = parsePhoneNumber(values);

if (parsedPhoneNumber.possible) {
if (parsedPhoneNumber.possible && Str.isValidPhone(values.slice(0))) {
return parsedPhoneNumber.number.e164 + CONST.SMS.DOMAIN;
}

Expand Down Expand Up @@ -94,7 +94,7 @@ function NewContactMethodPage(props) {
ErrorUtils.addErrorMessage(errors, 'phoneOrEmail', 'contacts.genericFailureMessages.contactMethodRequired');
}

if (!_.isEmpty(values.phoneOrEmail) && !((parsePhoneNumber(phoneLogin).possible && Str.isValidPhone(phoneLogin.slice(0))) || Str.isValidEmail(values.phoneOrEmail))) {
if (!_.isEmpty(values.phoneOrEmail) && !(validateIfnumber || Str.isValidEmail(values.phoneOrEmail))) {
ErrorUtils.addErrorMessage(errors, 'phoneOrEmail', 'contacts.genericFailureMessages.invalidContactMethod');
}

Expand Down

0 comments on commit eebb9e1

Please sign in to comment.