File tree 1 file changed +5
-8
lines changed
src/pages/settings/Wallet/InternationalDepositAccount 1 file changed +5
-8
lines changed Original file line number Diff line number Diff line change @@ -129,21 +129,18 @@ function getInitialSubstep(values: InternationalBankAccountForm, fieldsMap: Reco
129
129
130
130
function getValidationErrors ( values : FormOnyxValues < typeof ONYXKEYS . FORMS . INTERNATIONAL_BANK_ACCOUNT_FORM > , fieldsMap : CorpayFieldsMap , translate : LocaleContextProps [ 'translate' ] ) {
131
131
const errors = { } ;
132
- for ( const fieldName in fieldsMap ) {
133
- if ( ! fieldName ) {
134
- // eslint-disable-next-line no-continue
135
- continue ;
136
- }
137
- if ( fieldsMap [ fieldName ] . isRequired && values [ fieldName ] === '' ) {
132
+ Object . entries ( fieldsMap ) . forEach ( ( [ fieldName , field ] ) => {
133
+ if ( field . isRequired && values [ fieldName ] === '' ) {
138
134
ErrorUtils . addErrorMessage ( errors , fieldName , translate ( 'common.error.fieldRequired' ) ) ;
135
+ return ;
139
136
}
140
- fieldsMap [ fieldName ] . validationRules . forEach ( ( rule ) => {
137
+ field . validationRules . forEach ( ( rule ) => {
141
138
const regExpCheck = new RegExp ( rule . regEx ) ;
142
139
if ( ! regExpCheck . test ( values [ fieldName ] ) ) {
143
140
ErrorUtils . addErrorMessage ( errors , fieldName , rule . errorMessage ) ;
144
141
}
145
142
} ) ;
146
- }
143
+ } ) ;
147
144
return errors ;
148
145
}
149
146
You can’t perform that action at this time.
0 commit comments