MVP #6.1 #82

Merged
matthieu42morin merged 34 commits from master into deploy/prod 2023-03-31 17:40:26 +00:00
1 changed files with 4 additions and 2 deletions
Showing only changes of commit ed5a2222d6 - Show all commits

View File

@ -1,8 +1,10 @@
export const getLocationDataFromLatAndLong = async (latitude: number, longitude: number) => { export const getLocationDataFromLatAndLong = async (latitude: number, longitude: number) => {
const response = await fetch(`https://nominatim.openstreetmap.org/reverse?lat=${latitude}&lon=${longitude}&format=json`) const response = await fetch(`https://nominatim.openstreetmap.org/reverse?lat=${latitude}&lon=${longitude}&format=json`)
const data = await response.json() const data = await response.json()
console.log(data);
return { return {
city: data.address.town || data.address.city || data.address.village, city: data?.address?.town || data?.address?.city || data?.address?.village,
state: data.address.country, state: data?.address?.country,
} }
} }