in src/app/ContosoTraders.Ui.Website/src/components/footer/footer.tsx [25:41]
function showPosition(position) {
setLat(position.coords.latitude);
setLng(position.coords.longitude);
let point = position.coords.latitude + ',' + position.coords.longitude
const geoApiUrlForAddress = `${import.meta.env.VITE_REACT_APP_GEOAPIBASEURL}/Locations/${point}?key=${import.meta.env.VITE_REACT_APP_BINGMAPSKEY}`;
fetch(geoApiUrlForAddress)
.then(res => res.json())
.then(dat => {
setStatus(null);
if ( dat.resourceSets[0]) {
let address:string = dat.resourceSets[0].resources[0].address.locality + ', ' + dat.resourceSets[0].resources[0].address.countryRegion;
setLocation(address)
} else {
console.error(dat.errorDetails[0])
}
})
}