app/app/api/auth/login/route.ts
import { NextResponse } from "next/server";
export async function POST(req: Request) {
const { email, password, role } = await req.json();
if (!email || !password) return NextResponse.json({ error: "missing" }, { status: 400 });
const res = NextResponse.json({ ok: true, role });
res.cookies.set("cc_session", JSON.stringify({ email, role, ts: Date.now() }), {
httpOnly: true, sameSite: "lax", maxAge: 60 * 60 * 24 * 7
});
return res;
}