[BUG] Profile screen gets frozen when submitting invalid current password (#974)

* fix 968: [BUG] Profile screen gets frozen when submitting invalid current password

* revert changes to yarn.lock

* remove unnecessary line

* revert changes to yarn.lock

* revert changes to yarn.lock
This commit is contained in:
IlarionHalushka 2019-06-21 19:38:26 +03:00 committed by Diego Mello
parent e52739e305
commit dad18219dd
2 changed files with 8 additions and 5 deletions

View File

@ -29,4 +29,4 @@ export const Toast = React.forwardRef((props, ref) => (
opacity={0.8}
/>
));
export const showErrorAlert = (message: string, title: string) => Alert.alert(title, message, [{ text: 'OK', onPress: () => {} }], { cancelable: true });
export const showErrorAlert = (message, title, onPress = () => {}) => Alert.alert(title, message, [{ text: 'OK', onPress }], { cancelable: true });

View File

@ -151,8 +151,11 @@ export default class ProfileView extends React.Component {
if (e.data && e.data.errorType === 'error-too-many-requests') {
return showErrorAlert(e.data.error);
}
showErrorAlert(I18n.t('There_was_an_error_while_action', { action: I18n.t(action) }));
// log(func, e);
showErrorAlert(
I18n.t('There_was_an_error_while_action', { action: I18n.t(action) }),
'',
() => this.setState({ showPasswordAlert: false })
);
}
submit = async() => {
@ -162,7 +165,7 @@ export default class ProfileView extends React.Component {
return;
}
this.setState({ saving: true, showPasswordAlert: false });
this.setState({ saving: true });
const {
name, username, email, newPassword, currentPassword, avatar, customFields
@ -218,7 +221,7 @@ export default class ProfileView extends React.Component {
} else {
setUser({ ...params });
}
this.setState({ saving: false });
this.setState({ saving: false, showPasswordAlert: false });
this.toast.show(I18n.t('Profile_saved_successfully'));
this.init();
}