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:
co-authored by
Cursor
parent
c2552af079
commit
c53fb99330
@@ -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);
|
||||
}
|
||||
Reference in New Issue
Block a user