I have a variable
setup: {
const items = ref<basicPokemon[]>([]);
}
But i can't seem to get access to it in my function. I can however access it inside the 'methods' part, not inside the function. What am I doing wrong?
methods: {
this.items //this works
let response = axios({
url: 'https://stoplight.io/mocks/appwise-be/pokemon/57519009/pokemon',
method: 'get',
timeout: 8000,
headers: {
'Content-Type': 'application/json',
}})
.then(data => data.data.forEach(function(pok: basicPokemon){
try{
this.items.value.push(pok); //here I cannot access the variable
}
catch(err){
//todo error handling
console.log(err)
}
}))
}