let apiKey = 'a776e2df' let model = { getMovies(search){ return new Promise((resolve, reject) => { fetch(`http://www.omdbapi.com/?apikey=${apiKey}&s=${search}`) .then(response => { if (!response.ok) { throw new Error('Network response was not ok'); } return response.json(); }) .then(data => { resolve(data.Search); }) .catch(error => { console.error('There was a problem with the fetch operation:', error);} ) }) } } export default model