module.exports=[50502,a=>{"use strict";var b=a.i(87924),c=a.i(72131),d=a.i(50944),e=a.i(75844),f=a.i(90602);a.s(["default",0,function(){let[a,g]=(0,c.useState)(""),[h,i]=(0,c.useState)(""),j=(0,e.useAppDispatch)(),{loading:k,error:l}=(0,e.useAppSelector)(a=>a.auth),m=(0,d.useRouter)(),n=async b=>{b.preventDefault(),j((0,f.loginStart)());try{let b=await fetch("/api/auth/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:a,password:h})}),c=await b.json();b.ok?(j((0,f.loginSuccess)({user:c.user,token:c.token})),document.cookie=`token=${c.token}; path=/; max-age=86400`,console.log("Login successful, token stored in cookie"),m.push("/admin")):j((0,f.loginFailure)(c.error))}catch(a){j((0,f.loginFailure)("Network error"))}};return(0,b.jsx)("div",{className:"flex min-h-screen items-center justify-center bg-gray-2 dark:bg-[#020d1a]",children:(0,b.jsxs)("div",{className:"w-full max-w-md rounded-lg bg-white p-8 shadow-lg dark:bg-gray-800",children:[(0,b.jsx)("h2",{className:"mb-6 text-center text-2xl font-bold text-gray-900 dark:text-white",children:"Admin Login"}),(0,b.jsxs)("form",{onSubmit:n,className:"space-y-4",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{htmlFor:"email",className:"block text-sm font-medium text-gray-700 dark:text-gray-300",children:"Email"}),(0,b.jsx)("input",{type:"email",id:"email",value:a,onChange:a=>g(a.target.value),required:!0,className:"mt-1 block w-full rounded-md border border-gray-300 px-3 py-2 shadow-sm focus:border-indigo-500 focus:outline-none focus:ring-indigo-500 dark:border-gray-600 dark:bg-gray-700 dark:text-white"})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{htmlFor:"password",className:"block text-sm font-medium text-gray-700 dark:text-gray-300",children:"Password"}),(0,b.jsx)("input",{type:"password",id:"password",value:h,onChange:a=>i(a.target.value),required:!0,className:"mt-1 block w-full rounded-md border border-gray-300 px-3 py-2 shadow-sm focus:border-indigo-500 focus:outline-none focus:ring-indigo-500 dark:border-gray-600 dark:bg-gray-700 dark:text-white"})]}),l&&(0,b.jsx)("div",{className:"text-red-600 dark:text-red-400",children:l}),(0,b.jsx)("button",{type:"submit",disabled:k,className:"w-full rounded-md bg-indigo-600 px-4 py-2 text-white hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2 disabled:opacity-50",children:k?"Logging in...":"Login"})]})]})})}])}];

//# sourceMappingURL=src_app_admin_login_page_tsx_0wk_9cl._.js.map