People.Client: dialogs: ChangeEmailDialog: fixed error "Can't perform a React state update on an unmounted component."

This commit is contained in:
Daniil Senkiv 2019-12-23 14:01:01 +03:00
parent 902f6a768e
commit fca6ed2675

View File

@ -66,8 +66,8 @@ class ChangeEmailDialogComponent extends React.Component {
}) })
.catch((error) => toastr.error(error)) .catch((error) => toastr.error(error))
.finally(() => { .finally(() => {
this.props.onClose();
this.setState({ isRequestRunning: false }); this.setState({ isRequestRunning: false });
this.props.onClose();
}); });
}) })
}; };
@ -93,7 +93,8 @@ class ChangeEmailDialogComponent extends React.Component {
}; };
onKeyPress = event => { onKeyPress = event => {
if (event.key === "Enter") { const { isRequestRunning } = this.state;
if (event.key === "Enter" && !isRequestRunning) {
this.onValidateEmail(); this.onValidateEmail();
} }
}; };