fix calls to automations.save, which doesn't need the instanceId

This commit is contained in:
Maurits Lourens 2021-08-26 15:58:24 +02:00
parent ffca6f6980
commit ce3781e334
2 changed files with 3 additions and 11 deletions

View File

@ -1,13 +1,11 @@
<script> <script>
import { automationStore } from "builderStore" import { automationStore } from "builderStore"
import { database } from "stores/backend"
import { notifications, Button, Modal, Heading, Toggle } from "@budibase/bbui" import { notifications, Button, Modal, Heading, Toggle } from "@budibase/bbui"
import AutomationBlockSetup from "./AutomationBlockSetup.svelte" import AutomationBlockSetup from "./AutomationBlockSetup.svelte"
import CreateWebookModal from "../Shared/CreateWebhookModal.svelte" import CreateWebookModal from "../Shared/CreateWebhookModal.svelte"
let webhookModal let webhookModal
$: instanceId = $database._id
$: automation = $automationStore.selectedAutomation?.automation $: automation = $automationStore.selectedAutomation?.automation
$: automationLive = automation?.live $: automationLive = automation?.live
@ -16,7 +14,7 @@
return return
} }
automation.live = live automation.live = live
automationStore.actions.save({ instanceId, automation }) automationStore.actions.save(automation)
if (live) { if (live) {
notifications.info(`Automation ${automation.name} enabled.`) notifications.info(`Automation ${automation.name} enabled.`)
} else { } else {
@ -38,10 +36,7 @@
} }
async function saveAutomation() { async function saveAutomation() {
await automationStore.actions.save({ await automationStore.actions.save(automation)
instanceId,
automation,
})
notifications.success(`Automation ${automation.name} saved.`) notifications.success(`Automation ${automation.name} saved.`)
} }
</script> </script>

View File

@ -18,10 +18,7 @@
onMount(async () => { onMount(async () => {
if (!automation?.definition?.trigger?.inputs.schemaUrl) { if (!automation?.definition?.trigger?.inputs.schemaUrl) {
// save the automation initially // save the automation initially
await automationStore.actions.save({ await automationStore.actions.save(automation)
instanceId,
automation,
})
} }
interval = setInterval(async () => { interval = setInterval(async () => {
await automationStore.actions.fetch() await automationStore.actions.fetch()