import{d as m,a9 as p,r as g,as as y,af as n,ai as w,aj as h,aM as v,al as x,ae as l,an as b,ao as o,at as u,aq as A,am as C,aD as i}from"./index-BT5eY4j5.js";import{Q}from"./QPage-BfEPTOJq.js";const _=m({__name:"DeleteAccountView",setup(k){const r=w(),c=h(),s=p(),d=v(),a=g(!1);function f(){confirm("Are you sure that you want to delete your account? This action will permanently delete your account and all your data will be forever lost.")&&(a.value=!0,console.log(s.user),c.users.deleteSelf(s.user.id).then(t=>{if(a.value=!1,t.status>=300)throw new Error(t.data?.message??"Unknown error");return s.logout()}).then(()=>{d.push({name:i.Home}),r.notify({type:"positive",message:"Your account has been successfully deleted."})}).catch(t=>{a.value=!1,console.error(t),r.notify({type:"negative",message:"There was a problem deleting your account: "+(t?.message??"Unknown error.")})}))}return(t,e)=>(x(),y(Q,null,{default:n(()=>[l(C,{flat:"",class:"q-mx-auto",style:{"max-width":"475px"}},{default:n(()=>[l(b,{class:"text-center q-gutter-y-lg"},{default:n(()=>[e[2]||(e[2]=o("h1",{class:"text-h4 text-weight-bold"},"Delete Account",-1)),e[3]||(e[3]=o("p",null," This action will permanently delete your account and all your data will be forever lost. ",-1)),o("div",null,[l(u,{size:"lg",icon:"delete_forever",push:"",label:"Delete",loading:a.value,color:"red-7",onClick:e[0]||(e[0]=q=>f())},null,8,["loading"]),e[1]||(e[1]=o("br",null,null,-1)),l(u,{class:"q-mt-sm",size:"lg",icon:"cancel",flat:"",label:"Cancel",to:{name:A(i).Home}},null,8,["to"])])]),_:1})]),_:1})]),_:1}))}});export{_ as default};
