2
0

fix(engine): 🐛 Save variables from webhooks in results

This commit is contained in:
Baptiste Arnaud
2022-03-28 17:07:47 +02:00
parent cd6c5c04c5
commit 60dcd5c246
12 changed files with 98 additions and 56 deletions

View File

@ -54,11 +54,9 @@ export const TypebotPage = ({
setShowTypebot(true)
}
const handleVariablesPrefilled = async (
prefilledVariables: VariableWithValue[]
) => {
const handleNewVariables = async (variables: VariableWithValue[]) => {
if (!resultId) return setError(new Error('Result was not created'))
const { error } = await updateResult(resultId, { prefilledVariables })
const { error } = await updateResult(resultId, { variables })
if (error) setError(error)
}
@ -98,7 +96,7 @@ export const TypebotPage = ({
predefinedVariables={predefinedVariables}
onNewAnswer={handleNewAnswer}
onCompleted={handleCompleted}
onVariablesPrefilled={handleVariablesPrefilled}
onVariablesUpdated={handleNewVariables}
onNewLog={handleNewLog}
/>
)}