Commit dad18219 authored by IlarionHalushka's avatar IlarionHalushka Committed by Diego Mello

[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
parent e52739e3
......@@ -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 });
......@@ -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();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment