I'm fetching api request via basic fetchSpecialityArray() function:
fetchSpecialityArray(){
this.$http.get('http://127.0.0.1:8000/api/speciality')
.then(response => response.json())
.then(result => this.specialityTest = result).then(this.checkSpeciality())
},
then in checkSpeciality() method I'm checking if this request is complete:
checkSpeciality(){
console.log('check if complete and show array: ')
console.log(this.specialityTest)
},
Unfortunately I've got empty array in my console. When I trigger fetchSpecialityArray() method again I've got correct response in console.
What is the cause of this behaviour and how should I correct my code to make this work?