function getPageT()
{
Request.get({url: "https://cardanoexplorer.com/api/blocks/pages/total"}, (error, response, body) => {
if (error) {
return console.dir(error);
}
body = JSON.parse(body)
var total = body.Right
return Promise.resolve(total)
});
}
async function assign() {
var t = await getPageT()
console.log(t)
}
I would like the code above to print the total value but it comes as undefined because the getPage function does not wait for the request to be resolved.
How can I get the promise out of the Request.get ?