fix(ui) - initial data load on login

This commit is contained in:
Shekar Siri 2022-03-04 11:47:43 +01:00
parent d57959199b
commit a014c098f7

View file

@ -100,24 +100,26 @@ class Router extends React.Component {
constructor(props) {
super(props);
if (props.isLoggedIn) {
Promise.all([
props.fetchUserInfo().then(() => {
props.fetchIntegrationVariables()
}),
props.fetchSiteList().then(() => {
setTimeout(() => {
props.fetchAnnouncements();
props.fetchAlerts();
props.fetchWatchdogStatus();
}, 100);
}),
// props.fetchAnnouncements(),
])
// .then(() => this.onLoginLogout());
this.fetchInitialData();
}
props.fetchTenants();
}
fetchInitialData = () => {
Promise.all([
this.props.fetchUserInfo().then(() => {
this.props.fetchIntegrationVariables()
}),
this.props.fetchSiteList().then(() => {
setTimeout(() => {
this.props.fetchAnnouncements();
this.props.fetchAlerts();
this.props.fetchWatchdogStatus();
}, 100);
}),
])
}
componentDidMount() {
const { isLoggedIn, location } = this.props;
if (!isLoggedIn) {
@ -135,6 +137,10 @@ class Router extends React.Component {
this.props.history.push(this.state.destinationPath);
this.setState({ destinationPath: null });
}
if (!prevProps.isLoggedIn && this.props.isLoggedIn) {
this.fetchInitialData();
}
}
render() {