Web: People: Return to profile editor after save avatar

This commit is contained in:
Alexey Kostenko 2020-10-12 07:12:32 +03:00
parent 237f737ba7
commit 5838cd617c
2 changed files with 25 additions and 10 deletions

View File

@ -105,6 +105,7 @@ class AvatarEditorPage extends React.PureComponent {
})
.then(() => {
this.props.fetchProfile(profile.id);
this.returnToEditor(false);
});
} else {
deleteAvatar(profile.id)
@ -114,7 +115,10 @@ class AvatarEditorPage extends React.PureComponent {
})
.catch((error) => toastr.error(error))
.then(() => this.props.updateProfile(this.props.profile))
.then(() => this.props.fetchProfile(profile.id));
.then(() => {
this.props.fetchProfile(profile.id);
this.returnToEditor(false);
})
}
};

View File

@ -171,7 +171,8 @@ class UpdateUserForm extends React.Component {
[dialogsDataset.changeEmail]: false,
currentDialog: "",
},
isMobile: isMobile || isTablet, };
isMobile: isMobile || isTablet,
};
//Set unique contacts id
const now = new Date().getTime();
@ -418,9 +419,8 @@ class UpdateUserForm extends React.Component {
height: result.height,
tmpFile: avatar.tmpFile,
})
.then(() => {
.then(() => {
toastr.success(this.props.t("ChangesSavedSuccessfully"));
this.setState({ isLoading: false });
this.setIsEdit();
})
.catch((error) => {
@ -429,19 +429,30 @@ class UpdateUserForm extends React.Component {
})
.then(() => {
this.props.updateProfile(this.props.profile);
this.setState({ isLoading: false });
})
.then(() => {
this.props.fetchProfile(profile.id);
}); } else {
this.setState({
isLoading: false,
visibleAvatarEditor: false
});
})
.then(() => {
this.setState(this.mapPropsToState(this.props));
});
} else {
deleteAvatar(profile.id)
.then(() => { toastr.success(this.props.t("ChangesSavedSuccessfully"));
this.setState({ isLoading: false });
.then(() => {
toastr.success(this.props.t("ChangesSavedSuccessfully"));
this.setState({
isLoading: false,
visibleAvatarEditor: false
});
this.setIsEdit();
})
.catch((error) => toastr.error(error))
.then(() => this.props.updateProfile(this.props.profile))
.then(() => this.props.fetchProfile(profile.id)); }
.then(() => this.props.fetchProfile(profile.id));
}
};
onCloseAvatarEditor() {