Add shared customer auth, cart handoff, and account dropdown.

Mirror Meshkee customer sessions onto the storefront, continue checkout on the customer dashboard, and show profile/orders/admin links under the header name.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Alireza Hassani
2026-08-25 16:41:00 +03:30
co-authored by Cursor
parent c2552af079
commit c53fb99330
30 changed files with 2492 additions and 32 deletions
+36
View File
@@ -0,0 +1,36 @@
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);
}