1function getOptions(query) {
2 return new Promise((resolve, reject) => {
3 fetch(`https://www.thecocktaildb.com/api/json/v1/1/search.php?s=${query}`)
4 .then(response => response.json())
5 .then(({ drinks }) => {
6 resolve(drinks.map(({ idDrink, strDrink }) => ({ value: idDrink, name: strDrink })))
7 })
8 .catch(reject);
9 });
10}