chunk-ad9746d8.917304d6.js 7.73 KB
 1
 2
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-ad9746d8"],{b1bd:function(e,t,r){},c6f7:function(e,t,r){"use strict";r.r(t);var n=function(){var e=this,t=e.$createElement,r=e._self._c||t;return r("b-container",[r("b-col",{staticClass:"mx-auto",attrs:{sm:"8",md:"6",lg:"4"}},[r("b-card",{staticClass:"login-card"},[r("form",{on:{submit:function(t){return t.preventDefault(),e.login(t)}}},[r("h1",{staticClass:"title text-muted pb-3"},[e._v(" KEA ")]),r("b-form-group",[r("b-input-group",{staticClass:"input-group-seamless no-border",class:{"is-invalid":e.form.invalid("email")}},[r("b-input-group-prepend",[r("span",{staticClass:"input-group-text"},[r("fa",{class:{"text-danger":e.form.feedback("email")},attrs:{icon:"envelope"}})],1)]),r("b-form-input",{attrs:{type:"email",name:"email",required:"",state:e.form.state("email"),placeholder:"Email"},model:{value:e.form.email,callback:function(t){e.$set(e.form,"email",t)},expression:"form.email"}})],1),r("b-form-invalid-feedback",{attrs:{state:e.form.state("email")}},[r("div",{domProps:{innerHTML:e._s(e.form.feedback("email"))}})])],1),r("b-form-group",[r("b-input-group",{staticClass:"input-group-seamless no-border",class:{"is-invalid":e.form.invalid("password")}},[r("b-input-group-prepend",[r("span",{staticClass:"input-group-text"},[r("fa",{class:{"text-danger":e.form.feedback("password")},attrs:{icon:"lock"}})],1)]),r("b-form-input",{attrs:{type:"password",name:"password",required:"",state:e.form.state("password"),placeholder:"Password"},model:{value:e.form.password,callback:function(t){e.$set(e.form,"password",t)},expression:"form.password"}})],1)],1),r("b-button",{staticClass:"w-100",attrs:{type:"submit",block:"",variant:"primary",disabled:e.form.busy}},[e.form.busy?r("b-spinner",{staticClass:"spinner-center",attrs:{small:""}}):e._e(),e._v(" Login ")],1)],1)])],1)],1)},a=[],s=(r("96cf"),r("1da1")),o=(r("99af"),r("4de4"),r("4160"),r("caad"),r("13d5"),r("45fc"),r("b0c0"),r("b64b"),r("d3b7"),r("07ac"),r("ac1f"),r("2532"),r("5319"),r("159b"),r("ddb0"),r("ade3")),i=r("5530");r("a4d3"),r("e01a"),r("d28b"),r("e260"),r("3ca3");function u(e){return u="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},u(e)}function c(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function l(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function f(e,t,r){return t&&l(e.prototype,t),r&&l(e,r),e}var h=r("bc3a"),d=r.n(h);r("7db0"),r("4d63"),r("25f0"),r("1276"),r("2ca0"),r("498a");function b(e){if(null===e||"object"!==u(e))return e;var t=Array.isArray(e)?[]:{};return Object.keys(e).forEach((function(r){t[r]=b(e[r])})),t}function p(e){return Array.isArray(e)?e:[e]}var m=function(){function e(){c(this,e),this.errors={}}return f(e,[{key:"set",value:function(e,t){"object"===u(e)?this.errors=e:this.set(Object(i["a"])({},this.errors,Object(o["a"])({},e,p(t))))}},{key:"all",value:function(){return this.errors}},{key:"has",value:function(e){return this.errors.hasOwnProperty(e)}},{key:"hasAny",value:function(){for(var e=this,t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return r.some((function(t){return e.has(t)}))}},{key:"any",value:function(){return Object.keys(this.errors).length>0}},{key:"get",value:function(e){if(this.has(e))return this.getAll(e)[0]}},{key:"getAll",value:function(e){return p(this.errors[e]||[])}},{key:"only",value:function(){for(var e=this,t=[],r=arguments.length,n=new Array(r),a=0;a<r;a++)n[a]=arguments[a];return n.forEach((function(r){var n=e.get(r);n&&t.push(n)})),t}},{key:"flatten",value:function(){return Object.values(this.errors).reduce((function(e,t){return e.concat(t)}),[])}},{key:"clear",value:function(e){var t=this,r={};e&&Object.keys(this.errors).forEach((function(n){n!==e&&(r[n]=t.errors[n])})),this.set(r)}}]),e}(),v=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};c(this,e),this.busy=!1,this.successful=!1,this.errors=new m,this.originalData=b(t),Object.assign(this,t)}return f(e,[{key:"fill",value:function(e){var t=this;this.keys().forEach((function(r){t[r]=e[r]}))}},{key:"data",value:function(){var e=this;return this.keys().reduce((function(t,r){return Object(i["a"])({},t,Object(o["a"])({},r,e[r]))}),{})}},{key:"keys",value:function(){return Object.keys(this).filter((function(t){return!e.ignore.includes(t)}))}},{key:"startProcessing",value:function(){this.errors.clear(),this.busy=!0,this.successful=!1}},{key:"finishProcessing",value:function(){this.busy=!1,this.successful=!0}},{key:"clear",value:function(){this.errors.clear(),this.successful=!1}},{key:"reset",value:function(){var t=this;Object.keys(this).filter((function(t){return!e.ignore.includes(t)})).forEach((function(e){t[e]=b(t.originalData[e])}))}},{key:"get",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.submit("get",e,t)}},{key:"post",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.submit("post",e,t)}},{key:"patch",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.submit("patch",e,t)}},{key:"put",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.submit("put",e,t)}},{key:"delete",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.submit("delete",e,t)}},{key:"submit",value:function(t,r){var n=this,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};this.startProcessing();var s="get"===t?{params:this.data()}:this.data();return new Promise((function(o,u){(e.axios||d.a).request(Object(i["a"])({url:n.route(r),method:t,data:s},a)).then((function(e){n.finishProcessing(),o(e)})).catch((function(e){n.busy=!1,e.response&&n.errors.set(n.extractErrors(e.response)),u(e)}))}))}},{key:"extractErrors",value:function(t){return t.data&&"object"===u(t.data)?t.data.errors?Object(i["a"])({},t.data.errors):t.data.message?{error:t.data.message}:Object(i["a"])({},t.data):{error:e.errorMessage}}},{key:"route",value:function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t;return e.routes.hasOwnProperty(t)&&(n=decodeURI(e.routes[t])),"object"!==u(r)&&(r={id:r}),Object.keys(r).forEach((function(e){n=n.replace("{".concat(e,"}"),r[e])})),n}},{key:"onKeydown",value:function(e){e.target.name&&this.errors.clear(e.target.name)}},{key:"feedback",value:function(e){if(this.errors.has(e))return this.errors.get(e)}},{key:"state",value:function(e){return(!this.errors.any()||!this.errors.has(e))&&null}},{key:"invalid",value:function(e){var t=this.state(e);return null!==t}}]),e}();v.routes={},v.errorMessage="Something went wrong. Please try again.",v.ignore=["busy","successful","errors","originalData"];var y=v,g={name:"Login",layout:"public",middleware:"guest",data:function(){return{form:new y({email:"",password:""})}},methods:{login:function(){var e=this;return Object(s["a"])(regeneratorRuntime.mark((function t(){var r,n;return regeneratorRuntime.wrap((function(t){while(1)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,e.form.post("/login");case 3:n=t.sent,r=n.data,t.next=10;break;case 7:return t.prev=7,t.t0=t["catch"](0),t.abrupt("return");case 10:return e.$store.dispatch("auth/saveToken",{token:r.token,remember:e.remember}),t.next=13,e.$store.dispatch("auth/fetchUser");case 13:e.$router.push({name:"panel.dashboard"});case 14:case"end":return t.stop()}}),t,null,[[0,7]])})))()}}},k=g,w=(r("fc45"),r("2877")),j=Object(w["a"])(k,n,a,!1,null,"844266b8",null);t["default"]=j.exports},fc45:function(e,t,r){"use strict";var n=r("b1bd"),a=r.n(n);a.a}}]);
//# sourceMappingURL=chunk-ad9746d8.917304d6.js.map