text: (this.webpackJsonphooked=this.webpackJsonphooked||[]).push([[0],[,,,,,function(e,t,n){e.exports=n(12)},,,,,function(e,t,n){},function(e,t,n){},function(e,t,n){"use strict";n.r(t);var a=n(0),r=n.n(a),o=n(3),c=n.n(o),i=(n(10),n(1)),s=n(4),l=(n(11),function(e){return r.a.createElement("header",{className:"App-header"},r.a.createElement("h2",null,e.text))}),u=function(e){var t=e.movie,n="N/A"===t.Poster?"https://m.media-amazon.com/images/M/MV5BMTczNTI2ODUwOF5BMl5BanBnXkFtZTcwMTU0NTIzMw@@._V1_SX300.jpg":t.Poster;return r.a.createElement("div",{className:"movie"},r.a.createElement("h2",null,t.Title),r.a.createElement("div",null,r.a.createElement("img",{width:"200",alt:"The movie titled: ".concat(t.Title),src:n})),r.a.createElement("p",null,"(",t.Year,")"))},m=function(e){var t=Object(a.useState)(""),n=Object(i.a)(t,2),o=n[0],c=n[1];return r.a.createElement("form",{className:"search"},r.a.createElement("input",{value:o,onChange:function(e){c(e.target.value)},type:"text"}),r.a.createElement("input",{onClick:function(t){t.preventDefault(),e.search(o),c("")},type:"submit",value:"SEARCH"}))};function p(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function E(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?p(n,!0).forEach((function(t){Object(s.a)(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):p(n).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var f="https://www.omdbapi.com/?s=man&apikey=4a3b711b",h={loading:!0,movies:[],errorMessage:null},d=function(e,t){switch(t.type){case"SEARCH_MOVIES_REQUEST":return E({},e,{loading:!0,errorMessage:null});case"SEARCH_MOVIES_SUCCESS":return E({},e,{loading:!1,movies:t.payload});case"SEARCH_MOVIES_FAILURE":return E({},e,{loading:!1,errorMessage:t.error});default:return e}};var v=function(){var e=Object(a.useReducer)(d,h),t=Object(i.a)(e,2),n=t[0],o=t[1];Object(a.useEffect)((function(){fetch(f).then((function(e){return e.json()})).then((function(e){o({type:"SEARCH_MOVIES_SUCCESS",payload:e.Search})}))}),[]);var c=n.movies,s=n.errorMessage,p=n.loading;return r.a.createElement("div",{className:"App"},r.a.createElement(l,{text:"HOOKED"}),r.a.createElement(m,{search:function(e){o({type:"SEARCH_MOVIES_REQUEST"}),fetch("https://www.omdbapi.com/?s=".concat(e,"&apikey=4a3b711b")).then((function(e){return e.json()})).then((function(e){"True"===e.Response?o({type:"SEARCH_MOVIES_SUCCESS",payload:e.Search}):o({type:"SEARCH_MOVIES_FAILURE",payload:e.Error})}))}}),r.a.createElement("p",{className:"App-intro"},"Sharing a few of our favourite movies"),r.a.createElement("div",{className:"movies"},p&&!s?r.a.createElement("span",null,"loading..."):s?r.a.createElement("div",{className:"errorMessage"},s):c.map((function(e,t){return r.a.createElement(u,{key:"".concat(t,"-").concat(e.Title),movie:e})}))))};Boolean("localhost"===window.location.hostname||"[::1]"===window.location.hostname||window.location.hostname.match(/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/));c.a.render(r.a.createElement(v,null),document.getElementById("root")),"serviceWorker"in navigator&&navigator.serviceWorker.ready.then((function(e){e.unregister()}))}],[[5,1,2]]]);
  //# sourceMappingURL=main.43f2342a.chunk.js.map