text: "use strict";(self.webpackChunk=self.webpackChunk||[]).push([[571],{126:(e,t,r)=>{r.r(t),r.d(t,{default:()=>m});var a=r(395),l=r(386),o=r(875),n=r(96),s=r(759),i=r(946);const m=(0,a.Ih)((function(){const e={userController:i.ZP,form:null,serverErrors:null,onEnter:()=>{if(!s.a.isAuthenticated)return n.Z.transitionTo("/login"),!1;t()}},t=()=>{e.form=new l.Z({children:[{name:"image",initialValue:s.a.image},{name:"username",initialValue:s.a.username,validate:(0,o.Uf)((0,o.C1)(),(0,i.xE)())},{name:"bio",initialValue:s.a.bio},{name:"email",initialValue:s.a.email,validate:(0,o.C1)()},{name:"password",validate:(0,i.vx)()}],actions:{submit:()=>{e.update(e.form.getResult())}},onFormChange:()=>{e.serverErrors=null}})};return e.update=({username:t,email:r,password:a,image:l,bio:o})=>(e.serverErrors=null,i.ZP.update({username:t,email:r,password:a,image:l,bio:o}).then((()=>{n.Z.transitionTo("/")}),(t=>{e.serverErrors=t}))),e.logout=()=>{i.ZP.logout(),n.Z.transitionTo("/")},e}))},964:(e,t,r)=>{r.r(t),r.d(t,{default:()=>m});var a=r(408),l=r(294),o=r(697),n=r.n(o),s=r(898);function i(){return(i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(e[a]=r[a])}return e}).apply(this,arguments)}class m extends a.Component{constructor(){super(),this.onSubmit=e=>{e.preventDefault(),this.props.controller.form.submit()},this.onClickLogout=()=>{this.props.controller.logout()}}render(){const{form:e,serverErrors:t,isPending:r}=this.props.controller;return l.createElement("div",{className:"settings-page"},l.createElement("div",{className:"container page"},l.createElement("div",{className:"row"},l.createElement("div",{className:"col-md-6 offset-md-3 col-xs-12"},l.createElement("h1",{className:"text-xs-center"},"Your Settings"),t&&l.createElement("ul",{className:"error-messages"},t.map(((e,t)=>l.createElement("li",{key:t},e)))),l.createElement("form",{onSubmit:this.onSubmit},l.createElement("fieldset",null,l.createElement("fieldset",{className:"form-group"},l.createElement(s.Z,i({inputClassName:"form-control",type:"text",placeholder:"URL of profile picture",disabled:r},e.get("image")))),l.createElement("fieldset",{className:"form-group"},l.createElement(s.Z,i({inputClassName:"form-control form-control-lg",type:"text",placeholder:"Your Name",disabled:r},e.get("username")))),l.createElement("fieldset",{className:"form-group"},l.createElement(s.Z,i({inputClassName:"form-control form-control-lg",type:"textarea",placeholder:"Short bio about you",inputProps:{rows:"8"},disabled:r},e.get("bio")))),l.createElement("fieldset",{className:"form-group"},l.createElement(s.Z,i({inputClassName:"form-control form-control-lg",type:"email",placeholder:"Email",disabled:r},e.get("email")))),l.createElement("fieldset",{className:"form-group"},l.createElement(s.Z,i({inputClassName:"form-control form-control-lg",type:"password",placeholder:"Password",disabled:r},e.get("password")))),l.createElement("button",{className:"btn btn-lg btn-primary pull-xs-right",disabled:r},"Update Settings"))),l.createElement("hr",null),l.createElement("button",{className:"btn btn-outline-danger",disabled:r,onClick:this.onClickLogout},"Or click here to logout.")))))}}m.propTypes={controller:n().object.isRequired}}}]);
  //# sourceMappingURL=settings.bundle-b054ab59683cbae7a4a4.js.map