const getNewUser = async () => {
const data = await api.get("/").then((data) => data.data.results[0]);
console.log(data);
return data;
};
console.log(getNewUser());
In the code above when I console.log(data) in the function I get the correct body as a JSON format however the console.log(getNewUser()) shows a promise as opposed to a JSON object.
api is an axios instance