2 lines
9.5 KiB
JavaScript
2 lines
9.5 KiB
JavaScript
webpackJsonp([1],{"90d9":function(t,e){},BihB:function(t,e){},GK12:function(t,e){},NHnr:function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=s("7+uW"),a={render:function(){var t=this.$createElement,e=this._self._c||t;return e("div",{attrs:{id:"app"}},[e("router-view")],1)},staticRenderFns:[]};var i=s("VU/8")({name:"App"},a,!1,function(t){s("90d9")},null,null).exports,o=s("/ocq"),r=s("mtWM"),c=s.n(r),l={name:"ping",data:function(){return{msg:""}},methods:{getMessage:function(){var t=this;c.a.get("/chainetv/api/v1/ping").then(function(e){t.msg=e.data}).catch(function(t){console.error(t)})}},created:function(){this.getMessage()}},u={render:function(){var t=this.$createElement,e=this._self._c||t;return e("div",[e("h1",[this._v(this._s(this.msg))])])},staticRenderFns:[]};var h=s("VU/8")(l,u,!1,function(t){s("anuS")},"data-v-894ab75e",null).exports,d=s("lHA8"),m=s.n(d),v=s("Gu7T"),p=s.n(v),f="/chainetv/api/v1";var g=new n.a;var _={render:function(){var t=this,e=t.$createElement,s=t._self._c||e;return s("div",[s("div",{staticClass:"modal is-active"},[s("div",{staticClass:"modal-background"}),t._v(" "),s("button",{staticClass:"modal-close is-large",attrs:{"aria-label":"close"},on:{click:function(e){return t.$emit("close")}}}),t._v(" "),s("div",{staticClass:"modal-content box"},[t._t("default")],2)])])},staticRenderFns:[]},w=s("VU/8")({},_,!1,null,null,null).exports,C={data:function(){return{name:"",password:"",errorMsg:""}},components:{modal:w},methods:{authenticate:function(){var t=this;this.$store.dispatch("login",{name:this.name,password:this.password}).then(function(){t.$store.getters.isAuthenticated&&t.$emit("close")})},register:function(){var t=this;this.$store.dispatch("register",{name:this.name,password:this.password}).then(function(){return t.$router.push("/")})}},mounted:function(){var t=this;g.$on("failedRegistering",function(e){t.errorMsg=e}),g.$on("failedAuthentication",function(e){t.errorMsg=e})},beforeDestroy:function(){g.$off("failedRegistering"),g.$off("failedAuthentication")}},k={render:function(){var t=this,e=t.$createElement,s=t._self._c||e;return s("modal",{on:{close:function(e){return t.$emit("close")}}},[s("div",{staticClass:"hero is-success"},[s("div",{staticClass:"hero-body has-text-centered"},[s("h2",{staticClass:"title"},[t._v("Login")]),t._v(" "),s("p",{staticClass:"subtitle error-msg"},[t._v(t._s(t.errorMsg))])])]),t._v(" "),s("section",{staticClass:"section",on:{keyup:function(e){return!e.type.indexOf("key")&&t._k(e.keyCode,"enter",13,e.key,"Enter")?null:t.authenticate(e)}}},[s("div",{staticClass:"field"},[s("label",{staticClass:"label",attrs:{for:"name"}},[t._v("Name:")]),t._v(" "),s("div",{staticClass:"control"},[s("input",{directives:[{name:"model",rawName:"v-model",value:t.name,expression:"name"}],staticClass:"input",attrs:{type:"name",id:"email"},domProps:{value:t.name},on:{input:function(e){e.target.composing||(t.name=e.target.value)}}})])]),t._v(" "),s("div",{staticClass:"field"},[s("label",{staticClass:"label",attrs:{for:"password"}},[t._v("Password:")]),t._v(" "),s("div",{staticClass:"control"},[s("input",{directives:[{name:"model",rawName:"v-model",value:t.password,expression:"password"}],staticClass:"input",attrs:{type:"password",id:"password"},domProps:{value:t.password},on:{input:function(e){e.target.composing||(t.password=e.target.value)}}})])]),t._v(" "),s("div",{staticClass:"control"},[s("a",{staticClass:"button is-success is-large",on:{click:t.authenticate}},[t._v("Login")])])])])},staticRenderFns:[]},b={name:"chainetv",components:{modalLogin:s("VU/8")(C,k,!1,null,null,null).exports,modal:w},data:function(){return{chaine:"",showModalLogin:!1,showModal:!1,modalmessage:""}},methods:{checkchaine:function(){var t=this;if(""===this.chaine)return this.modalmessage="rentrer un numéro de chaine",void(this.showModal=!0);this.$store.state.arrayresultchaines=[];var e=[].concat(p()(new m.a(this.chaine.split(" ")))),s=new RegExp("^[0-9]*-[0-9]*$");e.forEach(function(e){if(""!==e)if(s.test(e))for(var n=e.split("-").map(Number),a=n[0];a<=n[1];a+=1)t.$store.dispatch("getchaine",{num:a});else t.$store.dispatch("getchaine",{num:e})})},parsechaine:function(){var t,e=this;return this.$store.getters.isAuthenticated?(t=this.$store.state.jwt.token,c.a.put(f+"/chaine/","",{headers:{Authorization:"Bearer: "+t}})).then(function(t){"OK"===t.data&&(e.modalmessage="update database OK",e.showModal=!0)}).catch(function(t){t.response?(e.modalmessage=t.response.data.message,e.showModal=!0):console.error(t),e.$router.push("/login")}):(this.showModalLogin=!0,!0)}},mounted:function(){var t=this;g.$on("showmodallogin",function(){t.showModalLogin=!0})}},y={render:function(){var t=this,e=t.$createElement,s=t._self._c||e;return s("div",[t._m(0),t._v(" "),s("div",{staticClass:"section has-text-centered"},[s("div",{staticClass:"container"},[s("div",{staticClass:"field"},[s("div",{staticClass:"control"},[s("input",{directives:[{name:"model",rawName:"v-model",value:t.chaine,expression:"chaine"}],staticClass:"input",attrs:{title:"entrer des numéros de chaine ou une gamme lié par un -",autofocus:"",name:"chaine-input",type:"text"},domProps:{value:t.chaine},on:{keyup:function(e){return!e.type.indexOf("key")&&t._k(e.keyCode,"enter",13,e.key,"Enter")?null:t.checkchaine()},input:function(e){e.target.composing||(t.chaine=e.target.value)}}})])]),t._v(" "),s("div",{staticClass:"field field is-grouped is-grouped-centered"},[s("div",{staticClass:"control"},[s("button",{staticClass:"button is-success",on:{click:function(e){return t.checkchaine()}}},[t._v("search")])]),t._v(" "),s("div",{staticClass:"control"},[s("button",{staticClass:"button is-success",on:{click:function(e){return t.parsechaine()}}},[t._v("update chaine")])])])]),t._v(" "),s("div",{staticClass:"section"},[s("div",{staticClass:"container"},[this.$store.state.arrayresultchaines?s("ul",{},t._l(this.$store.state.arrayresultchaines,function(e){return s("li",{key:e.chaine,staticClass:"box"},[s("h3",{staticClass:"title is-5"},[t._v(t._s(e.chaine)+" : "+t._s(e.name))]),t._v(" "),"can't find channel"!=e.emission&&e.emission?s("ul",[s("li",[s("h4",{staticClass:"title is-4"},[s("a",{staticClass:"has-text-success",attrs:{target:"_blank",href:e.emission.href}},[t._v(t._s(e.emission.title))])])]),t._v(" "),s("li",[s("img",{attrs:{src:e.emission.img}})]),t._v(" "),s("li",[s("p",[t._v(t._s(e.emission.synopsis))])]),t._v(" "),e.emission.casting&&0!=e.emission.casting.length?s("div",[s("h4",{staticClass:"title is-6"},[t._v("casting:")]),t._v(" "),s("div",{staticClass:"list is-hoverable"},t._l(e.emission.casting,function(e,n){return s("a",{key:n,staticClass:"has-text-success list-item",attrs:{target:"_blank",href:"https://fr.wikipedia.org/wiki/"+e.replace(" ","_")}},[s("i",[t._v(t._s(e))])])}),0)]):t._e()]):s("p",[t._v(t._s(e.emission))])])}),0):t._e()])])]),t._v(" "),s("modalLogin",{directives:[{name:"show",rawName:"v-show",value:t.showModalLogin,expression:"showModalLogin"}],on:{close:function(e){t.showModalLogin=!1}}}),t._v(" "),s("modal",{directives:[{name:"show",rawName:"v-show",value:t.showModal,expression:"showModal"}],on:{close:function(e){t.showModal=!1}}},[s("p",[t._v(t._s(t.modalmessage))]),t._v(" "),s("button",{staticClass:"button is-success",on:{click:function(e){t.showModal=!1}}},[t._v("close")])])],1)},staticRenderFns:[function(){var t=this.$createElement,e=this._self._c||t;return e("section",{staticClass:"hero has-text-centered is-success is-fullheigh"},[e("div",{staticClass:"hero-body"},[e("h1",{staticClass:"title"},[this._v("ChaineTV")])])])}]};var $=s("VU/8")(b,y,!1,function(t){s("BihB")},null,null).exports,x=s("NYxO");n.a.use(x.a);var M={getchaine:function(t,e){var s=e.num;return function(t){return c.a.get(f+"/chaine/"+t)}(s).then(function(e){200===e.status?t.dispatch("getemission",{chaine:s,name:e.data}):t.commit("push_chaine",{chaine:s,name:e.data})}).catch(function(t){console.error(t)})},getemission:function(t,e){var s,n=e.chaine,a=e.name;return(s=n,c.a.get(f+"/chaine/"+s+"/emission")).then(function(e){t.commit("push_chaine",{chaine:n,name:a,emission:e.data})}).catch(function(e){t.commit("push_chaine",{chaine:n,name:a}),console.error(e)})},login:function(t,e){return t.commit("setUserData",{userData:e}),function(t){return c.a.post(f+"/login/",t)}(e).then(function(e){return t.commit("setJwtToken",{jwt:e.data})}).catch(function(t){console.log("Error Authenticating: ",t),g.$emit("failedAuthentication",t.response.data.message)})}},A={push_chaine:function(t,e){e.name?t.arrayresultchaines.push({chaine:e.chaine,name:e.name,emission:e.emission}):t.arrayresultchaines.push({chaine:e.chaine,name:"inconnue"}),t.arrayresultchaines=t.arrayresultchaines.sort(function(t,e){return t.chaine<e.chaine?-1:t.chaine>e.chaine?1:0})},setUserData:function(t,e){console.log("setUserData payload = ",e),t.userData=e.userData},setJwtToken:function(t,e){console.log("setJwtToken payload = ",e),localStorage.token=e.jwt.token,t.jwt=e.jwt}},E={isAuthenticated:function(t){return function(t){if(!t||t.split(".").length<3)return!1;var e=JSON.parse(atob(t.split(".")[1])),s=new Date(1e3*e.exp);return new Date<s}(t.jwt.token)}},N=new x.a.Store({state:{arrayresultchaines:[],user:{},jwt:""},actions:M,mutations:A,getters:E});n.a.use(o.a);var L=new o.a({routes:[{path:"/",name:"chaineTV",component:$},{path:"/ping",name:"ping",component:h,beforeEnter:function(t,e,s){!function(t,e,s){N.getters.isAuthenticated?s():(s("/"),g.$emit("showmodallogin"))}(0,0,s)}}]});s("GK12");n.a.config.productionTip=!1,new n.a({el:"#app",router:L,store:N,components:{App:i},template:"<App/>"})},anuS:function(t,e){}},["NHnr"]);
|
|
//# sourceMappingURL=app.4531b81aca620b5eb3ab.js.map
|