Industries
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { NextResponse } from 'next/server';
|
||||
import { db } from '@/lib/db';
|
||||
import { Prisma } from '@prisma/client';
|
||||
import { NextResponse } from 'next/server';
|
||||
import { db } from '@/lib/db';
|
||||
import { Prisma } from '@prisma/client';
|
||||
|
||||
interface LeadInput {
|
||||
email: string;
|
||||
@@ -25,17 +25,17 @@ export async function POST(request: Request) {
|
||||
// Use typed db client - keeping (db as any) temporarily if types are missing locally,
|
||||
// but cleaner code should use db.lead directly.
|
||||
// We will trust the user to run `npm run build` which runs `prisma generate`.
|
||||
const lead = await db.lead.create({
|
||||
data: {
|
||||
email: email.toLowerCase().trim(),
|
||||
const lead = await db.lead.create({
|
||||
data: {
|
||||
email: email.toLowerCase().trim(),
|
||||
source: source || 'reprint-calculator',
|
||||
reprintCost: reprintCost ? Number(reprintCost) : null,
|
||||
updatesPerYear: updatesPerYear ? Number(updatesPerYear) : null,
|
||||
annualSavings: annualSavings ? Number(annualSavings) : null,
|
||||
},
|
||||
});
|
||||
|
||||
return NextResponse.json({ success: true, id: lead.id });
|
||||
},
|
||||
});
|
||||
|
||||
return NextResponse.json({ success: true, id: lead.id });
|
||||
} catch (error) {
|
||||
console.error('Error saving lead:', error);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user