mirror of
https://git.rwth-aachen.de/acs/public/villas/web/
synced 2025-03-09 00:00:01 +01:00
Make API calls in componentDidMount instead of componentWillMount, closes #84
This commit is contained in:
parent
b801a50901
commit
d03d7bacdc
9 changed files with 9 additions and 9 deletions
|
@ -48,7 +48,7 @@ class Home extends React.Component {
|
|||
return '?';
|
||||
}
|
||||
|
||||
componentWillMount() {
|
||||
componentDidMount() {
|
||||
//RestAPI.get('/api/v1/counts').then(response => {
|
||||
// this.setState({ counts: response });
|
||||
//});
|
||||
|
|
|
@ -120,7 +120,7 @@ class Dashboard extends React.Component {
|
|||
}
|
||||
|
||||
|
||||
componentWillMount() {
|
||||
componentDidMount() {
|
||||
//document.addEventListener('keydown', this.handleKeydown.bind(this));
|
||||
|
||||
if (this.state.dashboard.has('id') === false) {
|
||||
|
|
|
@ -54,7 +54,7 @@ class Projects extends React.Component {
|
|||
};
|
||||
}
|
||||
|
||||
componentWillMount() {
|
||||
componentDidMount() {
|
||||
AppDispatcher.dispatch({
|
||||
type: 'projects/start-load',
|
||||
token: this.state.sessionToken
|
||||
|
|
|
@ -80,7 +80,7 @@ class Scenario extends React.Component {
|
|||
}
|
||||
}
|
||||
|
||||
componentWillMount() {
|
||||
componentDidMount() {
|
||||
AppDispatcher.dispatch({
|
||||
type: 'scenarios/start-load',
|
||||
token: this.state.sessionToken
|
||||
|
|
|
@ -80,7 +80,7 @@ class Simulation extends React.Component {
|
|||
}
|
||||
}
|
||||
|
||||
componentWillMount() {
|
||||
componentDidMount() {
|
||||
AppDispatcher.dispatch({
|
||||
type: 'simulations/start-load',
|
||||
token: this.state.sessionToken
|
||||
|
|
|
@ -47,7 +47,7 @@ class SimulationModel extends React.Component {
|
|||
};
|
||||
}
|
||||
|
||||
componentWillMount() {
|
||||
componentDidMount() {
|
||||
AppDispatcher.dispatch({
|
||||
type: 'simulationModels/start-load',
|
||||
data: this.props.match.params.simulationModel,
|
||||
|
|
|
@ -88,7 +88,7 @@ class Simulators extends Component {
|
|||
};
|
||||
}
|
||||
|
||||
componentWillMount() {
|
||||
componentDidMount() {
|
||||
AppDispatcher.dispatch({
|
||||
type: 'simulators/start-load',
|
||||
token: this.state.sessionToken,
|
||||
|
|
|
@ -25,7 +25,7 @@ import { Redirect } from 'react-router-dom';
|
|||
import AppDispatcher from '../common/app-dispatcher';
|
||||
|
||||
class Logout extends React.Component {
|
||||
componentWillMount() {
|
||||
componentDidMount() {
|
||||
AppDispatcher.dispatch({
|
||||
type: 'users/logout'
|
||||
});
|
||||
|
|
|
@ -77,7 +77,7 @@ class Widget extends React.Component {
|
|||
};
|
||||
}
|
||||
|
||||
componentWillMount() {
|
||||
componentDidMount() {
|
||||
if (this.state.sessionToken == null) {
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue