This commit is contained in:
Nikita Gopienko 2020-02-07 13:08:03 +03:00
commit cbf7da6093
3 changed files with 11 additions and 13 deletions

View File

@ -177,12 +177,9 @@ class SectionHeaderContent extends React.PureComponent {
this.setState(stateCopy);
})
.catch(error => toastr.error(error))
.then(() => this.props.updateProfile(this.props.profile))
.then(() => this.props.fetchProfile(this.state.profile.id))
.then(() => this.props.updateProfile(this.state.profile))
.then((profile) => {
toastr.success(this.props.t("ChangesApplied"));
this.props.history.push(`${this.props.settings.homepage}/view/${profile.userName}`);
})
.then(() => toastr.success(this.props.t("ChangesApplied")))
.catch((error) => {
toastr.error(error);
});
@ -218,12 +215,9 @@ class SectionHeaderContent extends React.PureComponent {
const { fetchProfile, updateUserStatus, t } = this.props;
updateUserStatus(status, new Array(userId))
.then(() => this.props.updateProfile(this.props.profile))
.then(() => fetchProfile(userId))
.then(() => toastr.success(t('SuccessChangeUserStatus')))
.then(() => this.props.updateProfile(this.props.profile))
.then((profile) => {
this.props.history.push(`${this.props.settings.homepage}/view/${profile.userName}`);
})
.catch(error => toastr.error(error))
};

View File

@ -4,7 +4,7 @@ import { connect } from 'react-redux'
import { Avatar, Button, Textarea, Text, toastr, AvatarEditor, Link } from 'asc-web-components'
import { withTranslation, Trans } from 'react-i18next';
import { toEmployeeWrapper, getUserRole, getUserContactsPattern, getUserContacts, mapGroupsToGroupSelectorOptions, mapGroupSelectorOptionsToGroups, filterGroupSelectorOptions } from "../../../../../store/people/selectors";
import { updateProfile, getUserPhoto } from '../../../../../store/profile/actions'
import { updateProfile, getUserPhoto, fetchProfile } from '../../../../../store/profile/actions'
import { MainContainer, AvatarContainer, MainFieldsContainer } from './FormFields/Form'
import TextField from './FormFields/TextField'
import TextChangeField from './FormFields/TextChangeField'
@ -310,7 +310,9 @@ class UpdateUserForm extends React.Component {
toastr.success(this.props.t("ChangesSavedSuccessfully"));
this.setState(stateCopy);
})
.catch((error) => toastr.error(error));
.catch(error => toastr.error(error))
.then(() => this.props.updateProfile(this.props.profile))
.then(() => this.props.fetchProfile(this.state.profile.id))
} else {
deleteAvatar(this.state.profile.id)
.then((response) => {
@ -688,6 +690,6 @@ const mapStateToProps = (state) => {
export default connect(
mapStateToProps,
{
updateProfile
updateProfile, fetchProfile
}
)(withRouter(withTranslation()(UpdateUserForm)));

View File

@ -118,7 +118,8 @@ export function setFilterUrl(filter) {
params.push(`${SORT_BY}=${filter.sortBy}`);
params.push(`${SORT_ORDER}=${filter.sortOrder}`);
if (params.length > 0) {
const isProfileView = history.location.pathname.includes('/people/view') || history.location.pathname.includes('/people/edit');
if (params.length > 0 && !isProfileView) {
history.push(`${config.homepage}/filter?${params.join("&")}`);
}
}
@ -171,6 +172,7 @@ export function fetchPeople(filter, dispatchFunc = null) {
function fetchPeopleByFilter(dispatch, filter) {
let filterData = filter && filter.clone();
// console.log(history.location.pathname, history.location.pathname.includes('/people/view'));
if (!filterData) {
filterData = Filter.getDefault();