import{Q as f,a as u,b as g}from"./QCard-7tL_iMin.js";import{r as m,F as v,L as y,D as x,I as e,E as t,M as _,Q as I,J as Q}from"./index-CoQ-x5A8.js";import{Q as h}from"./QInput-CHJgTrNd.js";import{u as b}from"./use-quasar-D2Dr8mCf.js";import{P as p}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 D={class:"q-pa-md flex flex-center"},U={__name:"joinOnlineGamePage",setup(G){const l=v(),r=b(),a=m(),i=m({username:"",id:0}),n=p.getItem("user");n?(console.log(n),i.value=n):l.push("/user/username");async function d(){if(!a.value){r.notify({type:"negative",message:"Please enter a Game ID!"});return}w.post(`/api/games/${a.value}/players`,{user:i.value.id}).then(function(s){console.log(s),p.setItem("gameID",a.value),r.notify({type:"positive",message:"Success!"}),l.push("/game/online/create")}).catch(function(s){console.log(s),r.notify({type:"negative",message:s.response.data.error})})}return(s,o)=>(x(),y("div",D,[e(f,{class:"q-pa-lg shadow-3",style:{width:"400px","max-width":"90vw","border-radius":"16px"}},{default:t(()=>[e(u,{class:"text-center"},{default:t(()=>[...o[1]||(o[1]=[_("div",{class:"text-h6 q-mt-md"},"Enter Game ID",-1)])]),_:1}),e(u,null,{default:t(()=>[e(h,{modelValue:a.value,"onUpdate:modelValue":o[0]||(o[0]=c=>a.value=c),filled:"",label:"Game ID",type:"number",dense:"",style:{"border-radius":"6px"}},{prepend:t(()=>[e(I,{name:"public"})]),_:1},8,["modelValue"])]),_:1}),e(g,{align:"center"},{default:t(()=>[e(Q,{label:"Go!",color:"primary",onClick:d,rounded:"",unelevated:"",size:"lg",class:"full-width"})]),_:1})]),_:1})]))}};export{U as default};
