1import{_ as V,a as $}from"./8LWxjP_G.js";import{g as f,X as B,c as m,a as n,t as b,b as c,Z as y,o as d,T as C,ah as k,A as M,r as i,S as g,m as p,w as j,F as E,s as I,d as L,x as A}from"./BvrgkKY8.js";import{a as v}from"./DhXgJQ-f.js";const F=["for"],N=["textContent"],P=f({__name:"InputWithLabel",props:y({name:{},label:{},placeholder:{}},{modelValue:{},modelModifiers:{}}),emits:["update:modelValue"],setup(t){const e=B(t,"modelValue");return(s,a)=>{const l=V;return d(),m("label",{for:t.name,class:"text-sm flex flex-col"},[n("p",{class:"text-brandv2-black-900",textContent:b(t.label)},null,8,N),c(l,{modelValue:e.value,"onUpdate:modelValue":a[0]||(a[0]=o=>e.value=o),name:t.name,placeholder:t.placeholder},null,8,["modelValue","name","placeholder"])],8,F)}}}),W=Object.assign(P,{__name:"MoleculesBlogInputWithLabel"}),D={class:"flex gap-4 border border-brandv2-black-200 transition-all h-12 rounded-[10px] text-dark-blue w-max px-2 items-center justify-center"},O={class:"flex gap-4 rounded-full items-center justify-center"},S={class:"pl-2"},T={class:"p-2 hover:bg-red-500 hover:text-white flex items-center justify-center aspect-square rounded-md"},X=f({__name:"UserCard",props:{user:{}},emits:["deleteUser"],setup(t,{emit:e}){const s=e;return(a,l)=>{const o=C;return d(),m("div",D,[n("div",O,[n("p",S,b(t.user.email),1),n("button",T,[c(o,{name:"mdi-light:delete",onClick:l[0]||(l[0]=_=>s("deleteUser",t.user._id))})])])])}}}),Z=Object.assign(X,{__name:"MoleculesBlogUserCard"});function q(){const t=i([]),e=i(null),s=i(!1),a=async()=>{s.value=!0;try{const{data:l,error:o}=await M("/api/cms/auth/all",{credentials:"include"},"$7zYZXpUPha");if(o.value)throw new Error(o.value.message);t.value=l.value?.data??[]}catch(l){e.value=l.message}finally{s.value=!1}};return k(()=>{a()}),{users:t,error:e,loading:s,fetchUsers:a}}const z={class:"flex w-full h-[calc(100%-32px)] p-4 flex-col gap-4 bg-white m-4 rounded-xl"},R={class:"w-full h-full overflow-y-auto flex flex-col gap-4"},Y={class:"flex gap-2 h-max items-end"},G={class:"grid grid-cols-3 auto-rows-auto gap-4 w-full"},Q=f({__name:"index",setup(t){const e=i(""),s=i(""),a=async()=>{await v.post("/api/cms/auth/signup",{email:e.value,password:s.value}),_(),e.value="",s.value=""},l=async x=>{await v.delete(`/api/cms/auth/${x}`),_()},{users:o,fetchUsers:_}=q();return(x,r)=>{const h=W,w=$,U=Z;return d(),m("div",z,[n("div",R,[n("div",Y,[c(h,{modelValue:p(e),"onUpdate:modelValue":r[0]||(r[0]=u=>g(e)?e.value=u:null),placeholder:"Email",name:"email",label:"User email"},null,8,["modelValue"]),c(h,{modelValue:p(s),"onUpdate:modelValue":r[1]||(r[1]=u=>g(s)?s.value=u:null),placeholder:"Password",name:"password",label:"Password"},null,8,["modelValue"]),c(w,{onClick:a},{default:j(()=>[...r[2]||(r[2]=[L("Create user",-1)])]),_:1})]),n("div",G,[(d(!0),m(E,null,I(p(o),u=>(d(),A(U,{user:u,onDeleteUser:l},null,8,["user"]))),256))])])])}}});export{Q as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.