2
0

fix(webhook): 🐛 Sample result w/ multi input blocks

This commit is contained in:
Baptiste Arnaud
2022-03-21 17:05:51 +01:00
parent 5d3010d280
commit 7399140e49
12 changed files with 421 additions and 202 deletions

View File

@ -1,8 +1,8 @@
import prisma from 'libs/prisma'
import { ResultWithAnswers, Typebot, VariableWithValue } from 'models'
import { ResultWithAnswers, VariableWithValue } from 'models'
import { NextApiRequest, NextApiResponse } from 'next'
import { authenticateUser } from 'services/api/utils'
import { methodNotAllowed, parseAnswers } from 'utils'
import { methodNotAllowed } from 'utils'
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
if (req.method === 'GET') {
@ -20,9 +20,7 @@ const handler = async (req: NextApiRequest, res: NextApiResponse) => {
take: limit,
include: { answers: true },
})) as unknown as ResultWithAnswers[]
return res.send({
results: results.map(parseAnswers(typebot as unknown as Typebot)),
})
return res.send({ results })
}
if (req.method === 'POST') {
const typebotId = req.query.typebotId as string