Merge pull request #4709 from betagouv/4698-autocomplete-inclure-pas-resultats

#4698 - Possibilite de selectionner un resultat quand il n'y a rien de suggéré dans le champ adresse
This commit is contained in:
Keirua 2020-01-27 16:53:53 +01:00 committed by GitHub
commit e6fdf0d89e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -122,12 +122,16 @@ const adresseOptions = {
};
},
processResults(data) {
return {
results: data.features.map(({ properties: { label }, geometry }) => ({
let r = data.features.map(({ properties: { label }, geometry }) => ({
id: label,
text: label,
geometry
}))
}));
// Allow the user to select an arbitrary address missing from the results,
// by adding the plain-text query to the list of results.
r.unshift({ id: data.query, text: data.query });
return {
results: r
};
}
}