I can get the data easily from PromiseValue if I use it without await but since I'm using await to make the request Synchronous I can't get the data out of the function
currently I'm getting the data like this
Promise {pending}
proto: Promise
[[PromiseStatus]]: "resolved"
[[PromiseValue]]: ... html data goes here!
there's no way I can get the data from PromiseValue out of function I can only print them.
how can I get PromiseValue data while using Synchronous await method
the code I have now
const request = (async () => {
const response = await fetch(url,
{
method: 'get',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json'
}
});
const data = await response.text();
console.log(data);
})();
return request;
I can print out the data but I can't get them out of the function