feat(editor): ✨ Code step
This commit is contained in:
@ -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
|
||||
}
|
||||
|
Reference in New Issue
Block a user