I am trying to obtain the result of this 'response' into a variable that I can manipulate later. This is what I have so far
const url = my-url
const axios = require('axios').default;
async function getUser() {
try {
const response = await axios.get(url);
//console.log(response); // this is what I need
return response.data
} catch (error) {
console.error(error);
}
}
let results = await getUser();
console.log(results) // take results and do something with it
I do not understand why I cannot access the results.