import{y as p,r as n,z as f,A as h,u as N,j as t,f as j,D as b,F as A}from"./index-f9c70843.js";import{I as r}from"./input-ae70f3cc.js";function L(){const o=p(),[l,c]=n.useState(f),{login:i,isAuthenticated:I,setUserData:w}=n.useContext(h),{password:u,username:m}=l,d=N(e=>e.setErrorData);function a({target:{name:e,value:s}}){c(g=>({...g,[e]:s}))}function x(){b({username:m,password:u}).then(s=>{i(s.access_token),o("/admin/")}).catch(s=>{d({title:A,list:[s.response.data.detail]})})}return t.jsx("div",{className:"flex h-full w-full flex-col items-center justify-center bg-muted",children:t.jsxs("div",{className:"flex w-72 flex-col items-center justify-center gap-2",children:[t.jsx("span",{className:"mb-4 text-5xl",children:"⛓️"}),t.jsx("span",{className:"mb-6 text-2xl font-semibold text-primary",children:"Admin"}),t.jsx(r,{onChange:({target:{value:e}})=>{a({target:{name:"username",value:e}})},className:"bg-background",placeholder:"Username"}),t.jsx(r,{type:"password",onChange:({target:{value:e}})=>{a({target:{name:"password",value:e}})},className:"bg-background",placeholder:"Password"}),t.jsx(j,{onClick:()=>{x()},variant:"default",className:"w-full",children:"Login"})]})})}export{L as default};
