Fix issue where the data would refresh before the react state had updated

This commit is contained in:
Henry Whitaker
2021-09-10 18:16:17 +01:00
parent 9fb573e785
commit 0b1645cda0
4 changed files with 10 additions and 161184 deletions

View File

@@ -38,10 +38,9 @@ export default class HomePage extends Component {
updateDays = (days) => {
this.setState({ days: days });
this.getData();
this.setState({ days: days }, () => { this.getData() });
}
getData = () => {
axios.get('api/speedtest/home/' + this.state.days)
.then((resp) => {