diff --git a/html/static/js/address-suggestion.js b/html/static/js/address-suggestion.js index 29a1ce91..1c67e5ae 100644 --- a/html/static/js/address-suggestion.js +++ b/html/static/js/address-suggestion.js @@ -123,9 +123,7 @@ class AddressInput extends HTMLElement { el.addEventListener('click', e => { const index = parseInt(el.dataset.index); const suggestion = suggestions[index]; - this.value = suggestion.properties.full_address; - this._suggestions.innerHTML = ''; - + this.SetValue(suggestion); // Dispatch custom event this.dispatchEvent(new CustomEvent('address-selected', { bubbles: true, @@ -194,6 +192,11 @@ class AddressInput extends HTMLElement { this._suggestions.innerHTML = ''; } } + + SetValue(suggestion) { + this.value = suggestion.properties.full_address; + this._suggestions.innerHTML = ''; + } } customElements.define('address-input', AddressInput); diff --git a/html/static/js/geocode.js b/html/static/js/geocode.js index fcfa1f72..cd9274b3 100644 --- a/html/static/js/geocode.js +++ b/html/static/js/geocode.js @@ -7,5 +7,5 @@ async function geocodeReverse(MAPBOX_ACCESS_TOKEN, lngLat) { console.warn("No results for reverse geocode"); return; } - const match = data.features[0]; + return data } diff --git a/rmo/template/nuisance.html b/rmo/template/nuisance.html index df798e64..2ba9f6e2 100644 --- a/rmo/template/nuisance.html +++ b/rmo/template/nuisance.html @@ -11,6 +11,17 @@