I have been searching for a solution to my issue, but so far none of the suggestions have worked for me. Below is the code that I am struggling with:
const Element = () => {
async function getEndData() {
const data = (await getEnd());
return data;
}
}
const getEnd = async () => {
return await axios.get('http://localhost:8080/end').then(res => res.data);
}
Every time I call getEndData()
, it always returns a Promise "pending" with the value I need inside a [[PromiseResult]]. I even tried calling getEnd()
directly without using then()
and only returning the data, but still no luck. When I print res.data
in the console log, it shows the correct value that I need.