2
0

feat(editor): Code step

This commit is contained in:
Baptiste Arnaud
2022-03-07 17:39:57 +01:00
parent b2784f19fd
commit e3e07ddd4d
13 changed files with 239 additions and 16 deletions

View File

@ -8,6 +8,7 @@ import {
SetVariableStep,
RedirectStep,
Comparison,
CodeStep,
} from 'models'
import { isDefined, isNotDefined } from 'utils'
import { sanitizeUrl } from './utils'
@ -27,6 +28,8 @@ export const executeLogic = (
return executeCondition(step, variables)
case LogicStepType.REDIRECT:
return executeRedirect(step, variables)
case LogicStepType.CODE:
return executeCode(step)
}
}
@ -97,3 +100,9 @@ const executeRedirect = (
)
return step.outgoingEdgeId
}
const executeCode = (step: CodeStep) => {
if (!step.options.content) return
Function(step.options.content)()
return step.outgoingEdgeId
}