added document title change after group update and deletion

This commit is contained in:
Artem Tarasov 2020-09-17 15:58:46 +03:00
parent eb89987872
commit fcaf136b2c

View File

@ -60,22 +60,27 @@ const getItems = data => {
};
class ArticleBodyContent extends React.Component {
constructor(props) {
super(props);
componentDidMount() {
this.changeTitleDocument();
}
componentDidUpdate() {
this.changeTitleDocument();
}
changeTitleDocument() {
const {
organizationName,
groups,
selectedGroup,
selectedKeys,
currentModuleName
} = props;
} = this.props;
const currentGroup = getSelectedGroup(groups, selectedGroup);
const currentGroup = getSelectedGroup(groups, selectedKeys[0]);
document.title = currentGroup
? `${currentGroup.name} ${currentModuleName}`
: `${currentModuleName} ${organizationName}`;
}
shouldComponentUpdate(nextProps) {
if (
!utils.array.isArrayEqual(nextProps.selectedKeys, this.props.selectedKeys)