Updated backend/frontend
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
function geocode(query, callback) {
|
||||
fetch('https://nominatim.openstreetmap.org/search?format=json&q=' + encodeURIComponent(query))
|
||||
fetch('/geocode?format=json&q=' + encodeURIComponent(query))
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
if (data && data.length > 0) {
|
||||
@@ -16,7 +16,7 @@ document.addEventListener('DOMContentLoaded', function() {
|
||||
navigator.geolocation.getCurrentPosition(function(position) {
|
||||
var lat = position.coords.latitude;
|
||||
var lon = position.coords.longitude;
|
||||
fetch(`https://nominatim.openstreetmap.org/reverse?format=json&lat=${lat}&lon=${lon}`)
|
||||
fetch(`/reverse?format=json&lat=${lat}&lon=${lon}`)
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
document.getElementById(inputId).value = data.display_name || `${lat},${lon}`;
|
||||
@@ -54,7 +54,7 @@ document.addEventListener('DOMContentLoaded', function() {
|
||||
suggestionsBox.style.display = 'none';
|
||||
return;
|
||||
}
|
||||
fetch('https://nominatim.openstreetmap.org/search?format=json&addressdetails=1&q=' + encodeURIComponent(value))
|
||||
fetch('/geocode?format=json&addressdetails=1&q=' + encodeURIComponent(value))
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
suggestionsBox.innerHTML = '';
|
||||
|
||||
Reference in New Issue
Block a user