I need to Execute one function as a result of another function like as chain. I explain details on my code below.
const setter = async () => {
//this my first request that puts data in property value work right and get data.
setPropertyvalue(await (getpropertvalue(slide.slide, 0)));
const lat2 = parseInt(await return_value(propertyvalue, "geolocation_lat"));
//upper two const lat2&long2 depend on setpopertyvalue
const long2 = parseInt(await return_value(propertyvalue, "geolocation_long"));
setTimeout(() => { //and this code is running after all/ I consider time
setGeo({ ...geo, lat: lat2, long: long2 });
}, 2000);
};
setter(); // put this function in onload event
my problem = second part of code isn't work properly they just return NAN value - I think they are running before first part but I need to run these code after first part ;