Files
granblue-party/dist/assets/Account-DC5p92DM.js
2026-04-13 07:15:44 +00:00

2 lines
2.6 KiB
JavaScript

import{M as o}from"./ModalConfirm-q8xWqw9X.js";import{n as i}from"./index-DDNMzpZj.js";const r={components:{ModalConfirm:o},head:{title:"Granblue.Party - My Account"},data(){return{email:null,show_modal_delete:!1}},methods:{changeEmail(){this.axios.post("/user/email",{email:this.email}).then(t=>{this.$store.commit("setEmail",this.email),this.$store.dispatch("addMessage",{message:"Email saved successfully"})}).catch(t=>this.$store.dispatch("addAxiosErrorMessage",t))},deleteAccount(){this.axios.post("/user/delete").then(t=>{this.$store.commit("logout"),this.$router.push({name:"home"})}).catch(t=>this.$store.dispatch("addAxiosErrorMessage",t))}},computed:{emailModified(){return this.$store.getters.getEmail!=this.email}},mounted(){this.email=this.$store.getters.getEmail},watch:{"$store.getters.getUserId"(t){t===null&&this.$router.push({name:"home"}).catch(()=>{})}}};var l=function(){var e=this,s=e._self._c;return s("div",{staticClass:"flex flex-col items-center gap-y-8"},[s("h1",[e._v("My account")]),s("form",{staticClass:"grid auto-cols-min",on:{submit:function(a){return a.preventDefault(),e.changeEmail()}}},[s("label",{attrs:{for:"username"}},[e._v("Username")]),s("input",{staticClass:"input",attrs:{id:"username",type:"text",disabled:""},domProps:{value:e.$store.getters.getUsername}}),s("label",{attrs:{for:"email"}},[e._v("Email address (optional)")]),s("input",{directives:[{name:"model",rawName:"v-model",value:e.email,expression:"email"}],ref:"email",staticClass:"input",attrs:{id:"email",type:"email",placeholder:"Email address"},domProps:{value:e.email},on:{input:function(a){a.target.composing||(e.email=a.target.value)}}}),s("p",{staticClass:"mt-4"},[s("input",{staticClass:"btn btn-blue",attrs:{type:"submit",value:"Save",disabled:!e.emailModified}})])]),e._m(0),e._m(1),s("button",{staticClass:"btn btn-red",on:{click:function(a){e.show_modal_delete=!0}}},[e._v("Delete account")]),s("modal-confirm",{attrs:{confirm:e.deleteAccount,text:"This action cannot be reverted",button:"Delete account"},model:{value:e.show_modal_delete,callback:function(a){e.show_modal_delete=a},expression:"show_modal_delete"}})],1)},n=[function(){var t=this,e=t._self._c;return e("p",{staticClass:"bg-secondary rounded p-4"},[t._v(' To reset your password, log out, then in the "Log in" panel,'),e("br"),t._v(' click on "Forgot password?" to receive a link to change your password. ')])},function(){var t=this,e=t._self._c;return e("p",{staticClass:"bg-secondary rounded p-4"},[t._v(" We will never send you spam or sell your email address."),e("br"),t._v(" Its only use is to recover your password if you forget it. ")])}],c=i(r,l,n,!1,null,null);const u=c.exports;export{u as default};