a simple question: I want to add simple numbers to an array, which I want to compare later to another array. But I can't access the content of the update-Array.
This is my code:
checkForUpdates(curr_dataset) {
var current = curr_dataset;
var update = [];
//put in array
axios.get('http://localhost:3030/disruptions/', {
params: {
DisruptionCategory: 0
}
})
.then(response => {
console.log("push " + response.data.data.length)
update.push(response.data.data.length);
})
.catch((error) => {
console.log(error.data);
});
axios.get('http://localhost:3030/disruptions/', {
params: {
DisruptionCategory: 1
}
})
.then(response => {
console.log("push " + response.data.data.length)
update.push(response.data.data.length);
})
.catch((error) => {
console.log(error.data);
});
axios.get('http://localhost:3030/disruptions/', {
params: {
DisruptionCategory: 2
}
})
.then(response => {
console.log("push " + response.data.data.length)
update.push(response.data.data.length);
})
.catch((error) => {
console.log(error.data);
});
axios.get('http://localhost:3030/disruptions/', {
params: {
DisruptionCategory: 3
}
})
.then(response => {
console.log("push " + response.data.data.length)
update.push(response.data.data.length);
})
.catch((error) => {
console.log(error.data);
});
console.log(update[0]); //HERE I GET "undefined"
}
To continue and compare the content of my update-Array with the current-Array I need to be sure that I've got the right values...
Anyone an idea?