Web: People: fixed error with change avatar

This commit is contained in:
Viktor Fomin 2021-08-02 14:41:19 +03:00
parent b403459fda
commit 578ab81947

View File

@ -448,7 +448,9 @@ class UpdateUserForm extends React.Component {
onSaveAvatar = (isUpdate, result, avatar) => {
this.setState({ isLoading: true });
const { profile, setAvatarMax } = this.props;
const { profile, setAvatarMax, personal } = this.props;
console.log("profile", profile);
if (isUpdate) {
createThumbnailsAvatar(profile.id, {
x: Math.round(result.x * avatar.defaultWidth - result.width / 2),
@ -483,7 +485,7 @@ class UpdateUserForm extends React.Component {
.then(() => {
this.updateUserPhotoInState();
})
.then(() => this.props.fetchProfile(profile.id));
.then(() => !personal && this.props.fetchProfile(profile.id));
} else {
deleteAvatar(profile.id)
.then((response) => {
@ -500,7 +502,7 @@ class UpdateUserForm extends React.Component {
.then(() => {
this.setState(this.mapPropsToState(this.props));
})
.then(() => this.props.fetchProfile(profile.id));
.then(() => !personal && this.props.fetchProfile(profile.id));
}
};