fix issue where automation block was not being added in the correct order

This commit is contained in:
Peter Clement 2021-10-11 11:10:26 +01:00
parent 0489bb5ee0
commit 5702eb464b
1 changed files with 4 additions and 4 deletions

View File

@ -4,10 +4,11 @@
import { externalActions } from "./ExternalActions" import { externalActions } from "./ExternalActions"
export let blockIdx export let blockIdx
export let blockComplete
let selectedAction let selectedAction
let actionVal let actionVal
let actions = Object.entries($automationStore.blockDefinitions.ACTION) let actions = Object.entries($automationStore.blockDefinitions.ACTION)
export let blockComplete
const external = actions.reduce((acc, elm) => { const external = actions.reduce((acc, elm) => {
const [k, v] = elm const [k, v] = elm
@ -36,10 +37,9 @@
actionVal.stepId, actionVal.stepId,
actionVal actionVal
) )
automationStore.actions.addBlockToAutomation(newBlock) automationStore.actions.addBlockToAutomation(newBlock, blockIdx + 1)
await automationStore.actions.save( await automationStore.actions.save(
$automationStore.selectedAutomation?.automation, $automationStore.selectedAutomation?.automation
blockIdx
) )
} }
</script> </script>