|
|
|
@ -29,8 +29,9 @@ export const createOsmClient = (): Geocoder => { |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
return { |
|
|
|
|
geocode: async (query) => { |
|
|
|
|
const result = await queue.add(() => geocoder.geocode(query)); |
|
|
|
|
geocode: async (query) => |
|
|
|
|
queue.add(async () => { |
|
|
|
|
const result = await geocoder.geocode(query); |
|
|
|
|
|
|
|
|
|
if (!result.length) { |
|
|
|
|
throw new Error('No results found'); |
|
|
|
@ -58,6 +59,6 @@ export const createOsmClient = (): Geocoder => { |
|
|
|
|
latitude: meanLatitude, |
|
|
|
|
longitude: meanLongitude, |
|
|
|
|
}; |
|
|
|
|
}, |
|
|
|
|
}), |
|
|
|
|
}; |
|
|
|
|
}; |
|
|
|
|