Merge branch 'release/1.0.0' into bugfix/profile-form-validation

This commit is contained in:
Tatiana Lopaeva 2021-10-05 16:02:02 +03:00
commit 47993da131
2 changed files with 34 additions and 1 deletions

View File

@ -101,13 +101,38 @@ class UpdateUserForm extends React.Component {
this.onSelectGroups = this.onSelectGroups.bind(this);
this.onRemoveGroup = this.onRemoveGroup.bind(this);
this.handleWindowBeforeUnload = this.handleWindowBeforeUnload.bind(this);
this.mainFieldsContainerRef = React.createRef();
}
componentDidMount() {
this.props.setIsEditTargetUser(true);
this.unblock = this.props.history.block((targetLocation) => {
if (this.props.isEdit) {
this.props.setIsVisibleDataLossDialog(true);
return false;
}
return true;
});
window.addEventListener("beforeunload", this.handleWindowBeforeUnload);
}
componentWillUnmount() {
this.unblock();
window.removeEventListener("beforeunload", this.handleWindowBeforeUnload);
}
handleWindowBeforeUnload = (e) => {
if (this.props.isEdit) {
e.preventDefault();
e.returnValue = "";
}
};
componentDidUpdate(prevProps, prevState) {
if (this.props.match.params.userId !== prevProps.match.params.userId) {
this.setState(this.mapPropsToState(this.props));
@ -341,6 +366,8 @@ class UpdateUserForm extends React.Component {
personal,
} = this.props;
this.unblock();
if (personal) {
history.push(combineUrl(AppServerConfig.proxyURL, "/my"));
} else if (isEditTargetUser || document.referrer) {

View File

@ -21,6 +21,10 @@ const config = {
entry: "./src/index",
mode: "development",
stats: {
errorDetails: true,
},
devServer: {
devMiddleware: {
publicPath: homepage,
@ -38,7 +42,9 @@ const config = {
// errors: true,
// warnings: true,
// }
overlay: true,
overlay: {
warnings: false,
},
progress: true,
},
port: 5001,