Update src/server/api_nominatim.ts
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
sora-ext 2025-02-25 18:02:57 +01:00
parent 58c6eaa868
commit d63845ed9a

View File

@ -1,4 +1,14 @@
function drop_fields(results) {
results.forEach(e => {
delete e.licence;
delete e.place_rank;
delete e.importance;
delete e.boundingbox;
});
return results
}
export function nominatim_get_data(id: string, bb: string[][] | null = null): Promise<any> {
if (!id) return Promise.resolve([])
@ -11,6 +21,6 @@ export function nominatim_get_data(id: string, bb: string[][] | null = null): Pr
}
return fetch(url).then((res) => {
if (!res.ok) throw new Error("Nominatim Error")
return res.json()
return res.json().then(r => drop_fields(r))
})
}