export function getHotOffers() {
let offers;
getRequest('/hot-offers').then(x => offers = x);
alert(offers);
return JSON.parse(offers);
}
That's my function I export. It makes request to the server asynchronously and get JSON string. When I debug the project, everything works and alert returns string but when I just execute the code, alert returns undefined. How can I fix this?