Skip to content

Commit

Permalink
cleaner way of presenting default contact delete error
Browse files Browse the repository at this point in the history
  • Loading branch information
lukemorawski committed Sep 20, 2023
1 parent ddd63b5 commit d0cb155
Showing 1 changed file with 8 additions and 19 deletions.
27 changes: 8 additions & 19 deletions src/pages/settings/Profile/Contacts/ContactMethodDetailsPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -285,25 +285,14 @@ class ContactMethodDetailsPage extends Component {
</OfflineWithFeedback>
) : null}
{isDefaultContactMethod ? (
<>
<OfflineWithFeedback
pendingAction={lodashGet(loginData, 'pendingFields.defaultLogin', null)}
errors={ErrorUtils.getLatestErrorField(loginData, 'defaultLogin')}
errorRowStyles={[styles.ml8, styles.mr5]}
onClose={() => User.clearContactMethodErrors(contactMethod, 'defaultLogin')}
>
<Text style={[styles.ph5, styles.mv3]}>{this.props.translate('contacts.yourDefaultContactMethod')}</Text>
</OfflineWithFeedback>
{isFailedRemovedContactMethod && (
<OfflineWithFeedback
errors={ErrorUtils.getLatestErrorField(loginData, 'deletedLogin')}
errorRowStyles={[styles.ml8, styles.mr5]}
onClose={() => User.clearContactMethodErrors(contactMethod, 'deletedLogin')}
>
<></>
</OfflineWithFeedback>
)}
</>
<OfflineWithFeedback
pendingAction={lodashGet(loginData, 'pendingFields.defaultLogin', null)}
errors={ErrorUtils.getLatestErrorField(loginData, isFailedRemovedContactMethod ? 'deletedLogin' : 'defaultLogin')}
errorRowStyles={[styles.ml8, styles.mr5]}
onClose={() => User.clearContactMethodErrors(contactMethod, isFailedRemovedContactMethod ? 'deletedLogin' : 'defaultLogin')}
>
<Text style={[styles.ph5, styles.mv3]}>{this.props.translate('contacts.yourDefaultContactMethod')}</Text>
</OfflineWithFeedback>
) : (
<OfflineWithFeedback
pendingAction={lodashGet(loginData, 'pendingFields.deletedLogin', null)}
Expand Down

0 comments on commit d0cb155

Please sign in to comment.