import{Q as i,a as o,b as d}from"./QCard-7tL_iMin.js";import{r as c,L as p,D as f,I as s,E as t,F as v,M as g,Q as x,J as _}from"./index-CoQ-x5A8.js";import{Q as y}from"./QInput-CHJgTrNd.js";import{u as Q}from"./use-quasar-D2Dr8mCf.js";import{P as h}from"./LocalStorage-Cw9j6RTB.js";import{a as w}from"./axios-BPt4fYpj.js";import"./use-dark-dqtTUvyg.js";import"./use-key-composition-DhHSCGmF.js";import"./use-id-G4Q8n9zP.js";import"./focus-manager-BJWzFvJg.js";const b={class:"q-pa-md flex flex-center"},z={__name:"usernamePage",setup(C){const l=v(),n=Q(),e=c({username:"",id:0});async function u(){if(!e.value.username){n.notify({type:"negative",message:"Please enter a username!"});return}w.post("/api/users",{username:e.value.username}).then(function(a){console.log(a),e.value.username=a.data.username,e.value.id=a.data.id,h.setItem("user",e.value),n.notify({type:"positive",message:"Success!"}),l.push("/")}).catch(function(a){console.log(a),n.notify({type:"negative",message:a.response.data.error})})}return(a,r)=>(f(),p("div",b,[s(i,{class:"q-pa-lg shadow-3",style:{width:"400px","max-width":"90vw","border-radius":"16px"}},{default:t(()=>[s(o,{class:"text-center"},{default:t(()=>[...r[1]||(r[1]=[g("div",{class:"text-h6 q-mt-md"},"Enter Username",-1)])]),_:1}),s(o,null,{default:t(()=>[s(y,{modelValue:e.value.username,"onUpdate:modelValue":r[0]||(r[0]=m=>e.value.username=m),filled:"",label:"Username",maxlength:"32",counter:"",dense:"",style:{"border-radius":"6px"}},{prepend:t(()=>[s(x,{name:"account_circle"})]),_:1},8,["modelValue"])]),_:1}),s(d,{align:"center"},{default:t(()=>[s(_,{label:"Go!",color:"primary",onClick:u,rounded:"",unelevated:"",size:"lg",class:"full-width"})]),_:1})]),_:1})]))}};export{z as default};
