2
0

feat(dashboard): Add lead generation template

While creating the template I also made sure to fix and improve everything I stumble upon
This commit is contained in:
Baptiste Arnaud
2022-02-07 07:13:16 +01:00
parent 524ef0812c
commit 1f320c5d99
20 changed files with 397 additions and 46 deletions

View File

@ -26,10 +26,13 @@ const handler = async (req: NextApiRequest, res: NextApiResponse) => {
if (req.method === 'POST') {
const data = JSON.parse(req.body)
const typebot = await prisma.typebot.create({
data: parseNewTypebot({
ownerId: user.id,
...data,
}) as Prisma.TypebotUncheckedCreateInput,
data:
'blocks' in data
? data
: (parseNewTypebot({
ownerId: user.id,
...data,
}) as Prisma.TypebotUncheckedCreateInput),
})
return res.send(typebot)
}