import "@babel/polyfill";
export async function resolveRemotePost(url){
const fetch = require('node-fetch');
return await fetch(url).then((data) => data.json());
}
export function getRemoteContent(url){
let webpage = resolveRemotePost(url);
console.log("Remote content")
console.log(webpage);
The following code tries to call a url and assign the json data to the variable webpage. However what it does instead is return a "promise". (I'm new to javascript). I understand how asynchronous functions work (i think) but in javascript I cannot seem to figure out how to exactly get the data I'm trying to fetch. My question is how do I unwrap this promise to retrieve the data contained within it?