import { DOMAIN } from "@/lib/meshkee"; import { jsonResponse, meshkeeFetch } from "@/lib/meshkee-server"; export async function POST(request: Request) { const body = await request.json().catch(() => null); if ( !body?.cellNumber || !body?.password || !body?.firstName || !body?.lastName ) { return jsonResponse({ error: "لطفاً همه فیلدهای الزامی را پر کنید" }, 400); } const res = await meshkeeFetch("/auth/register", { method: "POST", body: JSON.stringify({ cellNumber: body.cellNumber, password: body.password, firstName: body.firstName, lastName: body.lastName, email: body.email, domain: DOMAIN, acknowledgeExistingAccount: body.acknowledgeExistingAccount ?? false, }), }); if (!res.ok) { return jsonResponse( { error: "ثبت‌نام ناموفق بود. اطلاعات را بررسی کنید." }, res.status, ); } return jsonResponse(res.data, 201); }