From 179c5523b08bc1664079b4373fc0a7f4468e1da1 Mon Sep 17 00:00:00 2001 From: wafimohamed <158514667+wafimohamed@users.noreply.github.com> Date: Wed, 18 Dec 2024 13:15:42 -0500 Subject: [PATCH] Vebt 868 updated (#33621) * fixed issue with addressline 2 * fixed issue with addressline 2 --- .../components/addressSchema.js | 29 +++---------------- .../containers/ChangeOfAddressWrapper.jsx | 1 - 2 files changed, 4 insertions(+), 26 deletions(-) diff --git a/src/applications/verify-your-enrollment/components/addressSchema.js b/src/applications/verify-your-enrollment/components/addressSchema.js index b62540252e6a..e94b554a6886 100644 --- a/src/applications/verify-your-enrollment/components/addressSchema.js +++ b/src/applications/verify-your-enrollment/components/addressSchema.js @@ -11,28 +11,6 @@ import { import { blockURLsRegEx } from '../constants'; import { splitAddressLine } from '../helpers'; -const initializeAddressLine1 = formData => { - return formData?.addressLine1 !== undefined - ? splitAddressLine(formData?.addressLine1, 20).line1 - : splitAddressLine(formData?.street?.trim(), 20).line1; -}; - -const initializeAddressLine2 = formData => { - const address1 = - formData?.street?.length > 20 - ? splitAddressLine(formData?.addressLine1, 20).line2 - : splitAddressLine(formData?.addressLine2, 20).line1; - const address2 = - formData?.street?.length > 20 - ? splitAddressLine(formData?.street?.trim(), 20).line2 - : splitAddressLine(formData?.street2?.trim(), 20).line1; - - if (formData?.addressLine2 === undefined && address2 === '') { - return undefined; - } - return formData?.addressLine2 !== undefined ? address1 : address2; -}; - const cleanZipCode = zipcode => { return zipcode?.substring(0, 5); }; @@ -45,7 +23,6 @@ const ADDRESS_FORM_VALUES = { COUNTRY_ISO3_CODES: countries.map(country => country.countryCodeISO3), MILITARY_STATES, }; - const STREET_LINE_MAX_LENGTH = 20; export const getFormSchema = (formData = {}) => { @@ -75,14 +52,16 @@ export const getFormSchema = (formData = {}) => { minLength: 1, maxLength: STREET_LINE_MAX_LENGTH, pattern: blockURLsRegEx, - default: initializeAddressLine1(formData), + default: splitAddressLine(formData?.addressLine1, 20).line1, }, addressLine2: { type: 'string', minLength: 1, maxLength: STREET_LINE_MAX_LENGTH, pattern: blockURLsRegEx, - default: initializeAddressLine2(formData), + default: + splitAddressLine(formData?.addressLine1, 20).line2 || + formData?.addressLine2, }, addressLine3: { type: 'string', diff --git a/src/applications/verify-your-enrollment/containers/ChangeOfAddressWrapper.jsx b/src/applications/verify-your-enrollment/containers/ChangeOfAddressWrapper.jsx index 0b7e20e6e3b4..a8a8b6eb880a 100644 --- a/src/applications/verify-your-enrollment/containers/ChangeOfAddressWrapper.jsx +++ b/src/applications/verify-your-enrollment/containers/ChangeOfAddressWrapper.jsx @@ -320,7 +320,6 @@ const ChangeOfAddressWrapper = ({ mailingAddress, loading, applicantName }) => { cancelEditClick={cancelEditClick} formType=" mailing address" /> - updateAddressData(addressData)}