Here is what I am trying to accomplish. In my app I want to check if a some data has been previously loaded up (from an API call elsewhere in the app). If not, then I want to load the data up. However, I don't want to go any further in the app until I am assured that I have the data.
So the pseudocode looks like this.
if (!dataIsloaded) {
axios.get("/api/getData").then((data) => {
saveData(data);
dataIsLoaded=true;
});
}
// don't go any further until I'm assured I have the data
Can someone provide a code snippet how to accomplish this? Thanks!