Skip to content

Commit

Permalink
fix(webhook): toggle connector enable state when toggling webhook ena…
Browse files Browse the repository at this point in the history
…ble state
  • Loading branch information
Kinplemelon committed Jan 23, 2025
1 parent 877b12c commit 75dfab3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/hooks/Rule/connector/useComponentsHandlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ export default (
}
}
const i18nPrefix = getI18nPrefix(BridgeType.MQTT)
if (comRet?.static_clientids.items.properties) {
if (comRet?.static_clientids?.items?.properties) {
const props = comRet.static_clientids.items.properties
if (props.ids) {
setLabelAndDesc(props.ids, `${i18nPrefix}ids`)
Expand Down
5 changes: 3 additions & 2 deletions src/hooks/Webhook/useWebhookItem.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { deleteAction, putActionEnable } from '@/api/action'
import { deleteConnector } from '@/api/connector'
import { deleteConnector, putConnectorEnable } from '@/api/connector'
import { deleteRules, updateRules } from '@/api/ruleengine'
import { WebhookItem } from '@/types/webhook'
import { ElMessage as M, ElMessageBox as MB } from 'element-plus'
Expand All @@ -8,7 +8,7 @@ import { ref } from 'vue'
import { useI18n } from 'vue-i18n'

export default (): {
toggleWebhookEnableStatus: (webhook: WebhookItem) => Promise<[any, any]>
toggleWebhookEnableStatus: (webhook: WebhookItem) => Promise<[any, any, any]>
deleteLoading: Ref<boolean>
deleteWebhook: (webhook: WebhookItem) => Promise<void>
} => {
Expand All @@ -23,6 +23,7 @@ export default (): {
return await Promise.all([
toggleBridgeEnableStatus(webhook.action.id, enable),
toggleRuleEnableStatus(webhook.rule.id, enable),
putConnectorEnable(webhook.connector.id, enable),
])
}

Expand Down

0 comments on commit 75dfab3

Please sign in to comment.