Work in Progress: How to fetch data and display the results as options in a dropdown
function result( {
input_field,
}) {
if (!input_field) return []
const input = document.querySelector("input.ComponentKey-input_field");
return fetch(`https://savvy-api-proxy.heysavvy.workers.dev/?url=${encodeURIComponent(`https://maps.googleapis.com/maps/api/place/autocomplete/json?input=${input_field}&types=address&components=country:us&key=YOUR_KEY`)}`)
.then(response => response.json())
.then(data => {
console.log(data)
let results = data.predictions.map(result => {
return {
key:result.place_id,
text:result.description
}
})
return results
})
}PreviousWork in Progress: How to fetch job offers from Lever’s APINextWork in Progress: How to create a new split test with 3 variants
Last updated