I have a fetch function inside a async function. I would like to be able to call my data variable outside the async() function. I can do that when using only fetch function but it continues to the next lines of code without waiting to finish fetching data. This question How to return the response from an asynchronous call doesn't solve my problem. It's using ajax. I am expecting having the response outside the function vs inside.
const request = async () => {
current_url = window.location.href
network_id = parseInt(current_url.split('/')[5])
const response = await fetch(`http://127.0.0.1:8000/network/${network_id}/edges.geojson/`);
const data = await response.json();
}
Any help is appreciated