Web: People: fixed updating avatar in user list after creating new user

This commit is contained in:
Artem Tarasov 2020-10-05 13:29:14 +03:00
parent 0836a55d68
commit 0a248e6f3b
2 changed files with 11 additions and 2 deletions

View File

@ -22,7 +22,10 @@ import {
createProfile,
updateCreatedAvatar,
} from "../../../../../store/profile/actions";
import { setFilter } from "../../../../../store/people/actions";
import {
setFilter,
updateProfileInUsers,
} from "../../../../../store/people/actions";
import {
MainContainer,
AvatarContainer,
@ -82,6 +85,7 @@ class CreateUserForm extends React.Component {
})
.then((res) => {
this.props.updateCreatedAvatar(res);
this.props.updateProfileInUsers();
toastr.success(this.props.t("ChangesSavedSuccessfully"));
this.props.history.push(
`${this.props.settings.homepage}/view/${userName}`
@ -602,4 +606,5 @@ export default connect(mapStateToProps, {
createProfile,
updateCreatedAvatar,
setFilter,
updateProfileInUsers,
})(withRouter(withTranslation()(CreateUserForm)));

View File

@ -245,12 +245,16 @@ export function resetFilter() {
export function updateProfileInUsers(updatedProfile) {
return (dispatch, getState) => {
if (!updatedProfile) {
const { profile } = getState();
updatedProfile = profile.targetUser;
}
const { userName } = updatedProfile;
const { people } = getState();
const { users } = people;
if (!users) {
const { filter } = people;
return updateUserList(dispatch);
}