Initial commit: ANOUMA website with Payload CMS, WebRTC meetings, and booking system
- Next.js 16 App Router site with the ANOUMA design system - Payload CMS (PostgreSQL) for offers, events, posts and page content - WebRTC video-call system with custom signaling server - SMTP email reminders and booking-request notifications - Customer accounts, calendar-based availability, and booking workflow
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
import { headers } from "next/headers";
|
||||
import { getPayload } from "payload";
|
||||
import config from "@payload-config";
|
||||
import type { Customer } from "@/payload-types";
|
||||
|
||||
/** Returns the logged-in customer for the current request, or null. Never returns an admin user. */
|
||||
export async function getCurrentCustomer(): Promise<Customer | null> {
|
||||
const payload = await getPayload({ config });
|
||||
const { user } = await payload.auth({ headers: await headers() });
|
||||
if (!user || user.collection !== "customers") return null;
|
||||
return user as Customer;
|
||||
}
|
||||
Reference in New Issue
Block a user