import{a as e,k as t}from"./init-Ck7wRxmZ.js";import{N as a}from"./Navbar-CshJBn-L.js";import"./theme-BfDtj5yE.js";import"./_plugin-vue_export-helper-DlAUqK2U.js";const o=e({components:{Navbar:a},data(){return{error:null,success:!1,passwordData:{currentUsername:"",currentPassword:"",newUsername:"",newPassword:"",confirmNewPassword:""}}},methods:{save(){if(this.passwordData.newPassword!==this.passwordData.confirmNewPassword){this.error="Password mismatch";return}this.error=null,fetch("./api/password",{credentials:"include",headers:{"Content-Type":"application/json"},method:"POST",body:JSON.stringify(this.passwordData)}).then(s=>{s.status===200?s.json().then(r=>{this.success=r.status,this.success===!0?setTimeout(()=>{document.location.reload()},5e3):this.error=r.error}):this.error="Internal Server Error"})}}});t(o);
