(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-2d0a3726"],{"01e4":function(e,t,n){"use strict";n.r(t);var a=function(){var e=this,t=e._self._c;return t("div",{staticClass:"backend-content",attrs:{id:"content"}},[t("div",{staticClass:"column col-8 col-xs-12"},[t("br"),t("p",[t("strong",[e._v("A new SpyGuard version is available ("+e._s(e.next_version)+").")]),t("br"),e.update_launched?e._e():t("span",[e._v("Please click on the button below to update your instance.")]),e.update_launched&&!e.update_finished?t("span",[e._v("Updating SpyGuard, please wait. You'll be redirected once updated.")]):e._e(),e.update_launched&&e.update_finished?t("span",{staticClass:"color-green"},[e._v("✓ Update finished!")]):e._e()]),e.update_finished?e._e():t("button",{staticClass:"btn btn-primary",class:[e.update_launched?"loading":""],on:{click:function(t){return e.launch_update()}}},[e._v("Update Spyguard")])])])},s=[],i=n("bc3a"),o=n.n(i),c={name:"update",data(){return{translation:{},update_launched:null,check_interval:null,next_version:null,current_version:null,update_finished:!1,jwt:""}},methods:{check_version:function(){o.a.get("/api/update/get-version",{timeout:6e4,headers:{"X-Token":this.jwt}}).then(e=>{e.data.status&&e.data.current_version==this.next_version&&(window.current_version=e.data.current_version,this.update_finished=!0,clearInterval(this.check_interval),setTimeout((function(){window.location.href="/"}),3e3))}).catch(e=>{console.log(e)})},launch_update:function(){o.a.get("/api/update/process",{timeout:6e4,headers:{"X-Token":this.jwt}}).then(e=>{e.data.status&&"Update successfully launched"==e.data.message&&(this.update_launched=!0,this.check_interval=setInterval(function(){this.check_version()}.bind(this),3e3))}).catch(e=>{console.log(e)})},async get_jwt(){await o.a.get("/api/get-token",{timeout:1e4}).then(e=>{e.data.token&&(this.jwt=e.data.token)}).catch(e=>console.log(e))},get_versions:function(){o.a.get("/api/update/check",{timeout:6e4,headers:{"X-Token":this.jwt}}).then(e=>{e.data.status&&(this.current_version=e.data.current_version,this.next_version=e.data.next_version,this.current_version==this.next_version&&(window.location.href="/"))}).catch(e=>{console.log(e)})}},created:function(){this.get_jwt().then(()=>{this.get_versions()})}},u=c,r=n("2877"),d=Object(r["a"])(u,a,s,!1,null,null,null);t["default"]=d.exports}}]); //# sourceMappingURL=chunk-2d0a3726.bebe5116.js.map