text: (function(t){function e(e){for(var r,s,c=e[0],u=e[1],i=e[2],l=0,f=[];l<c.length;l++)s=c[l],Object.prototype.hasOwnProperty.call(o,s)&&o[s]&&f.push(o[s][0]),o[s]=0;for(r in u)Object.prototype.hasOwnProperty.call(u,r)&&(t[r]=u[r]);p&&p(e);while(f.length)f.shift()();return a.push.apply(a,i||[]),n()}function n(){for(var t,e=0;e<a.length;e++){for(var n=a[e],r=!0,c=1;c<n.length;c++){var u=n[c];0!==o[u]&&(r=!1)}r&&(a.splice(e--,1),t=s(s.s=n[0]))}return t}var r={},o={app:0},a=[];function s(e){if(r[e])return r[e].exports;var n=r[e]={i:e,l:!1,exports:{}};return t[e].call(n.exports,n,n.exports,s),n.l=!0,n.exports}s.m=t,s.c=r,s.d=function(t,e,n){s.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},s.r=function(t){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},s.t=function(t,e){if(1&e&&(t=s(t)),8&e)return t;if(4&e&&"object"===typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(s.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)s.d(n,r,function(e){return t[e]}.bind(null,r));return n},s.n=function(t){var e=t&&t.__esModule?function(){return t["default"]}:function(){return t};return s.d(e,"a",e),e},s.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},s.p="/";var c=window["webpackJsonp"]=window["webpackJsonp"]||[],u=c.push.bind(c);c.push=e,c=c.slice();for(var i=0;i<c.length;i++)e(c[i]);var p=u;a.push([0,"chunk-vendors"]),n()})({0:function(t,e,n){t.exports=n("56d7")},"034f":function(t,e,n){"use strict";var r=n("85ec"),o=n.n(r);o.a},"56d7":function(t,e,n){"use strict";n.r(e);n("e260"),n("e6cf"),n("cca6"),n("a79d");var r=n("2b0e"),o=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{attrs:{id:"app"}},[t._m(0),n("PostComponent")],1)},a=[function(){var t=this,e=t.$createElement,r=t._self._c||e;return r("a",{attrs:{href:"https://murmurache.com",target:"_blank",rel:"noopener"}},[r("img",{attrs:{alt:"Mini posts logo",src:n("cf05")}})])}],s=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"container"},[n("div",{staticClass:"create-post"},[n("label",{attrs:{for:"create-post"}},[t._v("Add a mini post")]),n("input",{directives:[{name:"model",rawName:"v-model",value:t.text,expression:"text"}],attrs:{type:"text",id:"create-post",placeholder:"Write something..."},domProps:{value:t.text},on:{keyup:function(e){return!e.type.indexOf("key")&&t._k(e.keyCode,"enter",13,e.key,"Enter")?null:t.createPost(e)},input:function(e){e.target.composing||(t.text=e.target.value)}}}),n("button",{on:{click:t.createPost}},[t._v("Post")])]),n("hr"),t.error?n("p",{staticClass:"error"},[t._v(t._s(t.error))]):t._e(),n("h1",[t._v("Latest Posts")]),n("div",{staticClass:"posts-container"},t._l(t.posts,(function(e,r){return n("div",{key:e._id,staticClass:"post",attrs:{item:e,index:r}},[n("span",{attrs:{"aria-hidden":"true"},on:{click:function(n){return t.deletePost(e._id)}}},[t._v("x")]),t._v(" "+t._s(e.createdAt.getDate()+"/"+(e.createdAt.getMonth()+1)+"/"+e.createdAt.getFullYear()+" ")+" "),n("p",{staticClass:"text"},[t._v(t._s(e.text))])])})),0)])},c=[],u=(n("96cf"),n("1da1")),i=(n("d81d"),n("d3b7"),n("5530")),p=n("d4ec"),l=n("bee2"),f=n("bc3a"),d=n.n(f),v="api/posts/",m=function(){function t(){Object(p["a"])(this,t)}return Object(l["a"])(t,null,[{key:"getPosts",value:function(){return new Promise((function(t,e){d.a.get(v).then((function(e){var n=e.data;t(n.map((function(t){return Object(i["a"])(Object(i["a"])({},t),{},{createdAt:new Date(t.createdAt)})})))})).catch((function(t){e(t)}))}))}},{key:"insertPost",value:function(t){return d.a.post(v,{text:t})}},{key:"deletePost",value:function(t){return d.a.delete("".concat(v).concat(t))}}]),t}(),h=m,b={name:"PostComponent",data:function(){return{posts:[],error:"",text:""}},created:function(){var t=this;return Object(u["a"])(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,h.getPosts();case 3:t.posts=e.sent,e.next=9;break;case 6:e.prev=6,e.t0=e["catch"](0),t.error=e.t0.message;case 9:case"end":return e.stop()}}),e,null,[[0,6]])})))()},methods:{createPost:function(){var t=this;return Object(u["a"])(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:if(t.text){e.next=3;break}return t.hasError=!0,e.abrupt("return");case 3:return e.next=5,h.insertPost(t.text);case 5:return e.next=7,h.getPosts();case 7:t.posts=e.sent,t.text="";case 9:case"end":return e.stop()}}),e)})))()},deletePost:function(t){var e=this;return Object(u["a"])(regeneratorRuntime.mark((function n(){return regeneratorRuntime.wrap((function(n){while(1)switch(n.prev=n.next){case 0:return n.next=2,h.deletePost(t);case 2:return n.next=4,h.getPosts();case 4:e.posts=n.sent;case 5:case"end":return n.stop()}}),n)})))()}}},g=b,x=(n("f744"),n("2877")),_=Object(x["a"])(g,s,c,!1,null,"19464a36",null),y=_.exports,P={name:"App",components:{PostComponent:y}},w=P,O=(n("034f"),Object(x["a"])(w,o,a,!1,null,null,null)),k=O.exports;r["a"].config.productionTip=!1,new r["a"]({render:function(t){return t(k)}}).$mount("#app")},"637e":function(t,e,n){},"85ec":function(t,e,n){},cf05:function(t,e,n){t.exports=n.p+"img/logo.9816a565.png"},f744:function(t,e,n){"use strict";var r=n("637e"),o=n.n(r);o.a}});
  //# sourceMappingURL=app.a68aa4ef.js.map