This question has already been answered:
there is a code
const fetchData = { data: [], ft(){ fetch('http://127.0.0.1:8000/api/v1/') .then(response => response.json()) .then(data => this.data.push(data)) .finally(() => { document.getElementById("myButton").style.backgroundColor = 'red'; // return this.data // console.log(this.data) }) .catch(error => console.log(error)) console.log(this.data) }, mapFt(){ console.log(this.ft()) //.map(i => console.log(i)) } } export default fetchData.ft() how do i pick up data from there?
