I'm Having some trouble with this function on a React project
let fetchData = async (event, imagen) => {
const apiURL = `https://some_api_call/${imagen}`;
await axios.get(apiURL).then((response) => {
console.log(response.data.Imagen1.data);
return response.data.Imagen1.data;
});
When i call it the Console.log returns Undefined but the console log above returns the data
fetchData(event, rowData.Codigo).then(function (response) {
console.log(response);
});
.thenor you can evenlet response=await fetchData(...args)