(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[520],{5602:(e,r,a)=>{Promise.resolve().then(a.bind(a,2386))},2386:(e,r,a)=>{"use strict";a.r(r),a.d(r,{default:()=>u});var s=a(5155),t=a(2115),l=a(2615),n=a(6046);function u(){let[e,r]=(0,t.useState)(""),[a,u]=(0,t.useState)(""),{data:i,status:d}=(0,l.useSession)(),c=(0,n.useRouter)();async function o(r){r.preventDefault();let s=await (0,l.signIn)("credentials",{email:e,password:a,redirect:!1});(null==s?void 0:s.error)?alert("Erro: "+s.error):c.push("/admin/admins")}return((0,t.useEffect)(()=>{"authenticated"===d&&c.push("/admin/admins")},[d,c]),"loading"===d)?(0,s.jsx)("div",{className:"flex justify-center items-center h-screen bg-gray-100",children:(0,s.jsx)("p",{children:"Carregando..."})}):(0,s.jsx)("div",{className:"flex justify-center items-center h-screen bg-gray-100",children:(0,s.jsxs)("form",{onSubmit:o,className:"w-full max-w-md bg-white shadow-md rounded px-8 py-6",children:[(0,s.jsx)("h1",{className:"text-2xl font-bold mb-6",children:"Login Admin"}),(0,s.jsxs)("div",{className:"mb-4",children:[(0,s.jsx)("label",{htmlFor:"email",className:"block text-gray-700 mb-1",children:"Email"}),(0,s.jsx)("input",{id:"email",className:"w-full border border-gray-300 rounded px-3 py-2",type:"email",value:e,onChange:e=>r(e.target.value),placeholder:"Digite seu email",required:!0})]}),(0,s.jsxs)("div",{className:"mb-4",children:[(0,s.jsx)("label",{htmlFor:"password",className:"block text-gray-700 mb-1",children:"Senha"}),(0,s.jsx)("input",{id:"password",className:"w-full border border-gray-300 rounded px-3 py-2",type:"password",value:a,onChange:e=>u(e.target.value),placeholder:"Digite sua senha",required:!0})]}),(0,s.jsx)("button",{type:"submit",className:"w-full bg-blue-600 text-white py-2 rounded hover:bg-blue-700",children:"Entrar"})]})})}},6046:(e,r,a)=>{"use strict";var s=a(6658);a.o(s,"useParams")&&a.d(r,{useParams:function(){return s.useParams}}),a.o(s,"useRouter")&&a.d(r,{useRouter:function(){return s.useRouter}}),a.o(s,"useSearchParams")&&a.d(r,{useSearchParams:function(){return s.useSearchParams}})}},e=>{var r=r=>e(e.s=r);e.O(0,[615,441,517,358],()=>r(5602)),_N_E=e.O()}]);