(()=>{var e={};e.id=2761,e.ids=[2761],e.modules={3295:e=>{"use strict";e.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},10846:e=>{"use strict";e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},24429:()=>{},29294:e=>{"use strict";e.exports=require("next/dist/server/app-render/work-async-storage.external.js")},44870:e=>{"use strict";e.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},63033:e=>{"use strict";e.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},64749:()=>{},88574:(e,t,r)=>{"use strict";r.r(t),r.d(t,{patchFetch:()=>x,routeModule:()=>u,serverHooks:()=>l,workAsyncStorage:()=>c,workUnitAsyncStorage:()=>d});var s={};r.r(s),r.d(s,{POST:()=>p});var o=r(30781),n=r(60554),a=r(31625),i=r(96396);async function p(e){try{let t=await e.json(),r=await fetch("http://localhost:3001/api/auth/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!r.ok){let e=await r.json();return i.NextResponse.json({message:e.message||"Authentication failed"},{status:r.status})}let{token:s,user:o}=await r.json();if(!s)throw Error("No token received from backend");let n=i.NextResponse.json({user:o},{status:200});return n.cookies.set("token",s,{httpOnly:!0,secure:!0,sameSite:"lax",path:"/",maxAge:86400}),n}catch(e){return console.error(e),new Response(JSON.stringify({error:"Server error"}),{status:500})}}let u=new o.AppRouteRouteModule({definition:{kind:n.RouteKind.APP_ROUTE,page:"/api/login/route",pathname:"/api/login",filename:"route",bundlePath:"app/api/login/route"},resolvedPagePath:"/home/kencert/Desktop/Work/consultingsystem/frontend/app/api/login/route.js",nextConfigOutput:"",userland:s}),{workAsyncStorage:c,workUnitAsyncStorage:d,serverHooks:l}=u;function x(){return(0,a.patchFetch)({workAsyncStorage:c,workUnitAsyncStorage:d})}}};var t=require("../../../webpack-runtime.js");t.C(e);var r=e=>t(t.s=e),s=t.X(0,[1625,9146],()=>r(88574));module.exports=s})();