Web: People/Components: Added handling of the cancel button

This commit is contained in:
Alexey Kostenko 2020-10-06 07:00:37 +03:00
parent ea9f691e1a
commit 5df3850527
2 changed files with 14 additions and 6 deletions

View File

@ -60,13 +60,16 @@ class SectionBodyContent extends React.PureComponent{
}
onBackClick = () => {
const {profile, settings} = this.props
this.props.history.push(`${settings.homepage}/edit/${profile.userName}`)
this.returnToEditor();
}
onCloseAvatarEditor = () => {
console.log("onCloseAvatarEditor")
onCancel = () => {
this.returnToEditor();
}
returnToEditor = () => {
const {profile, settings} = this.props
this.props.history.push(`${settings.homepage}/edit/${profile.userName}`)
}
onSaveAvatar = (isUpdate, result) => {
@ -181,6 +184,7 @@ class SectionBodyContent extends React.PureComponent{
visible={true}
onClose={this.onCloseAvatarEditor}
onSave={this.onSaveAvatar}
onCancel={this.onCancel}
onLoadFile={this.onLoadFileAvatar}
headerLabel={t("EditPhoto")}
selectNewPhotoLabel={t("selectNewPhotoLabel")}

View File

@ -71,6 +71,10 @@ class AvatarEditor extends React.Component {
this.saveAvatar();
};
onCancelButtonClick = () => {
this.props.onCancel();
}
saveAvatar = () => {
if (!this.state.existImage) {
this.props.onSave(this.state.existImage);
@ -206,7 +210,7 @@ class AvatarEditor extends React.Component {
label={cancelButtonLabel}
primary={false}
size="big"
onClick={this.onSaveButtonClick}
onClick={this.onCancelButtonClick}
/>
</StyledButtonsWrapper>