Fetch movie info with promises

Pulp Fiction
Genre: Crime, Drama
Released: 14 Oct 1994
Actors: John Travolta, Uma Thurman, Samuel L. Jackson
Director: Quentin Tarantino
The lives of two mob hitmen, a boxer, a gangster and his wife, and a pair of diner bandits intertwine in four tales of violence and redemption.
const e=document.querySelector(".spinner"),n=document.querySelector("form");n.addEventListener("submit",t=>{t.preventDefault();const r=new FormData(n),s=new URLSearchParams(r).toString();var o;o="https://www.omdbapi.com/?"+s,console.log(o),fetch(o).then(e=>{if(!e.ok)throw new Error(`An error has occurred: ${e.status} ${e.statusText}`);return e.json()}).then(e=>{let n=`\n <div class="card warning full-width">\n <p>No info found for <b>${title.value}</b></p>\n </div>`;"True"===e.Response&&(n=`\n <div class="row">\n <div class="col-sm-6">${e.Poster&&e.Poster.length>10?`<img src="${e.Poster}">`:""}</div>\n <div class="col-sm-6">\n <h2>${e.Title}</h2>\n <p><b>Genre: </b>${e.Genre}<br>\n <b>Released: </b>${e.Released}<br>\n <b>Actors: </b>${e.Actors}<br>\n <b>Director: </b>${e.Director}<br></p>\n <hr>\n <p class="text-justify">${e.Plot}</p>\n </div>\n </div>`),document.getElementById("movieContainer").innerHTML=n}).then(()=>{e.classList.add("hidden")}).catch(n=>{e.classList.add("hidden"),console.log(n)})}),n.dispatchEvent(new Event("submit"));
//# sourceMappingURL=omdb.js.map