(()=>{var e={};e.id=9188,e.ids=[9188],e.modules={10846:e=>{"use strict";e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},44870:e=>{"use strict";e.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},3295:e=>{"use strict";e.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},29294:e=>{"use strict";e.exports=require("next/dist/server/app-render/work-async-storage.external.js")},63033:e=>{"use strict";e.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},12412:e=>{"use strict";e.exports=require("assert")},55511:e=>{"use strict";e.exports=require("crypto")},94735:e=>{"use strict";e.exports=require("events")},29021:e=>{"use strict";e.exports=require("fs")},81630:e=>{"use strict";e.exports=require("http")},55591:e=>{"use strict";e.exports=require("https")},33873:e=>{"use strict";e.exports=require("path")},27910:e=>{"use strict";e.exports=require("stream")},83997:e=>{"use strict";e.exports=require("tty")},79551:e=>{"use strict";e.exports=require("url")},28354:e=>{"use strict";e.exports=require("util")},74075:e=>{"use strict";e.exports=require("zlib")},45247:()=>{},24930:(e,s,t)=>{"use strict";t.r(s),t.d(s,{patchFetch:()=>h,routeModule:()=>d,serverHooks:()=>g,workAsyncStorage:()=>l,workUnitAsyncStorage:()=>x});var r={};t.r(r),t.d(r,{POST:()=>c});var a=t(42706),o=t(28203),n=t(45994),i=t(39187),u=t(93292);let p="https://backendv2testing.eventx.fr";async function c(e){try{let{action:s,...t}=await e.json();if(!s)return i.NextResponse.json({error:"Action parameter is required"},{status:400});switch(s){case"login":if(!t.email||!t.password)return i.NextResponse.json({error:"Email and password are required"},{status:400});try{let e=await u.A.post(`${p}/auth/login`,{email:t.email,password:t.password,language:t.language||"en"},{headers:{"Content-Type":"application/json"}});if(200===e.data.status)return i.NextResponse.json({success:!0,data:e.data,token:e.data.token,refreshToken:e.data.refreshToken,user:e.data.user});return i.NextResponse.json({error:e.data.message||"Login failed",success:!1},{status:400})}catch(e){return i.NextResponse.json({error:e.response?.data?.message||"Login failed",success:!1},{status:e.response?.status||500})}case"register":if(!t.email||!t.password||!t.firstName||!t.lastName)return i.NextResponse.json({error:"Email, password, first name, and last name are required"},{status:400});try{let e=await u.A.post(`${p}/auth/register`,t,{headers:{"Content-Type":"application/json"}});if(200===e.data.status||201===e.data.status)return i.NextResponse.json({success:!0,data:e.data,message:"Registration successful"});return i.NextResponse.json({error:e.data.message||"Registration failed",success:!1},{status:400})}catch(e){return i.NextResponse.json({error:e.response?.data?.message||"Registration failed",success:!1},{status:e.response?.status||500})}default:return i.NextResponse.json({error:"Invalid action type. Use 'login' or 'register'"},{status:400})}}catch(e){return console.error("Error in authentication API:",e),i.NextResponse.json({error:"Failed to process authentication request",success:!1},{status:500})}}let d=new a.AppRouteRouteModule({definition:{kind:o.RouteKind.APP_ROUTE,page:"/api/auth/route",pathname:"/api/auth",filename:"route",bundlePath:"app/api/auth/route"},resolvedPagePath:"/Users/user/Desktop/nestjs/self sever portal/src/app/api/auth/route.ts",nextConfigOutput:"",userland:r}),{workAsyncStorage:l,workUnitAsyncStorage:x,serverHooks:g}=d;function h(){return(0,n.patchFetch)({workAsyncStorage:l,workUnitAsyncStorage:x})}},96487:()=>{},78335:()=>{}};var s=require("../../../webpack-runtime.js");s.C(e);var t=e=>s(s.s=e),r=s.X(0,[638,8312,3292],()=>t(24930));module.exports=r})();