diff --git a/frontend/app/Router.js b/frontend/app/Router.js index 782f47e74..89fbdd343 100644 --- a/frontend/app/Router.js +++ b/frontend/app/Router.js @@ -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() {