fix(ui) - initial data load on login
This commit is contained in:
parent
d57959199b
commit
a014c098f7
1 changed files with 20 additions and 14 deletions
|
|
@ -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() {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue