diff --git a/web/layouts/_partials/address_autocomplete.html b/web/layouts/_partials/address_autocomplete.html index 9d28ad7..374059c 100644 --- a/web/layouts/_partials/address_autocomplete.html +++ b/web/layouts/_partials/address_autocomplete.html @@ -14,8 +14,13 @@ this.responselength = 0 return [] } - result = await fetch("https://api.geocode.earth/v1/autocomplete/\?api_key=ge-4949288cd450ad31&text=" + this.input) + if(this.input.length < 3) { + this.responselength = 0 + return [] + } + result = await fetch("https://api-adresse.data.gouv.fr/search/?q=" + this.input) json = await result.json() + console.log(json) this.responselength = json["features"].length return json["features"] diff --git a/web/layouts/_partials/orb_address_autocomplete.html b/web/layouts/_partials/orb_address_autocomplete.html index 0c5bee5..c7a10f9 100644 --- a/web/layouts/_partials/orb_address_autocomplete.html +++ b/web/layouts/_partials/orb_address_autocomplete.html @@ -15,8 +15,13 @@ this.responselength = 0 return [] } - result = await fetch("https://api.geocode.earth/v1/autocomplete/\?api_key=ge-4949288cd450ad31&text=" + this.input) + if(this.input.length < 3) { + this.responselength = 0 + return [] + } + result = await fetch("https://api-adresse.data.gouv.fr/search/?q=" + this.input) json = await result.json() + console.log(json) this.responselength = json["features"].length return json["features"]