[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:
parent
e52739e305
commit
dad18219dd
|
@ -29,4 +29,4 @@ export const Toast = React.forwardRef((props, ref) => (
|
||||||
opacity={0.8}
|
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') {
|
if (e.data && e.data.errorType === 'error-too-many-requests') {
|
||||||
return showErrorAlert(e.data.error);
|
return showErrorAlert(e.data.error);
|
||||||
}
|
}
|
||||||
showErrorAlert(I18n.t('There_was_an_error_while_action', { action: I18n.t(action) }));
|
showErrorAlert(
|
||||||
// log(func, e);
|
I18n.t('There_was_an_error_while_action', { action: I18n.t(action) }),
|
||||||
|
'',
|
||||||
|
() => this.setState({ showPasswordAlert: false })
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
submit = async() => {
|
submit = async() => {
|
||||||
|
@ -162,7 +165,7 @@ export default class ProfileView extends React.Component {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.setState({ saving: true, showPasswordAlert: false });
|
this.setState({ saving: true });
|
||||||
|
|
||||||
const {
|
const {
|
||||||
name, username, email, newPassword, currentPassword, avatar, customFields
|
name, username, email, newPassword, currentPassword, avatar, customFields
|
||||||
|
@ -218,7 +221,7 @@ export default class ProfileView extends React.Component {
|
||||||
} else {
|
} else {
|
||||||
setUser({ ...params });
|
setUser({ ...params });
|
||||||
}
|
}
|
||||||
this.setState({ saving: false });
|
this.setState({ saving: false, showPasswordAlert: false });
|
||||||
this.toast.show(I18n.t('Profile_saved_successfully'));
|
this.toast.show(I18n.t('Profile_saved_successfully'));
|
||||||
this.init();
|
this.init();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue