mirror of
https://git.rwth-aachen.de/acs/public/villas/web/
synced 2025-03-09 00:00:01 +01:00
load scenarios upon mounting users page #308
This commit is contained in:
parent
f7a3a88c57
commit
1984cc65b8
1 changed files with 14 additions and 10 deletions
|
@ -41,22 +41,13 @@ class Users extends Component {
|
|||
}
|
||||
|
||||
static calculateState(prevState, props) {
|
||||
let token = localStorage.getItem("token");
|
||||
|
||||
// If there is a token available and this method was called as a result of loading users
|
||||
if (!prevState && token) {
|
||||
AppDispatcher.dispatch({
|
||||
type: 'users/start-load',
|
||||
token: token
|
||||
});
|
||||
}
|
||||
|
||||
if (prevState == null) {
|
||||
prevState = {};
|
||||
}
|
||||
|
||||
return {
|
||||
token: token,
|
||||
token: localStorage.getItem("token"),
|
||||
users: UsersStore.getState(),
|
||||
scenarios: ScenarioStore.getState(),
|
||||
usersToAdd: prevState.usersToAdd || new Map(),
|
||||
|
@ -72,6 +63,19 @@ class Users extends Component {
|
|||
};
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
AppDispatcher.dispatch({
|
||||
type: 'scenarios/start-load',
|
||||
token: this.state.token
|
||||
});
|
||||
|
||||
AppDispatcher.dispatch({
|
||||
type: 'users/start-load',
|
||||
token: this.state.token
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
closeNewModal(data) {
|
||||
this.setState({ newModal: false });
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue