feat(engine): ⚡️ Await for async code block
This commit is contained in:
@ -48,7 +48,7 @@ export const executeLogic = async (
|
|||||||
case LogicStepType.REDIRECT:
|
case LogicStepType.REDIRECT:
|
||||||
return { nextEdgeId: executeRedirect(step, context) }
|
return { nextEdgeId: executeRedirect(step, context) }
|
||||||
case LogicStepType.CODE:
|
case LogicStepType.CODE:
|
||||||
return { nextEdgeId: executeCode(step, context) }
|
return { nextEdgeId: await executeCode(step, context) }
|
||||||
case LogicStepType.TYPEBOT_LINK:
|
case LogicStepType.TYPEBOT_LINK:
|
||||||
return await executeTypebotLink(step, context)
|
return await executeTypebotLink(step, context)
|
||||||
}
|
}
|
||||||
@ -121,12 +121,12 @@ const executeRedirect = (
|
|||||||
return step.outgoingEdgeId
|
return step.outgoingEdgeId
|
||||||
}
|
}
|
||||||
|
|
||||||
const executeCode = (
|
const executeCode = async (
|
||||||
step: CodeStep,
|
step: CodeStep,
|
||||||
{ typebot: { variables } }: LogicContext
|
{ typebot: { variables } }: LogicContext
|
||||||
) => {
|
) => {
|
||||||
if (!step.options.content) return
|
if (!step.options.content) return
|
||||||
Function(parseVariables(variables)(step.options.content))()
|
await Function(parseVariables(variables)(step.options.content))()
|
||||||
return step.outgoingEdgeId
|
return step.outgoingEdgeId
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user