diff --git a/resources/js/components/automation-rules/create-automation-rule-dialog.tsx b/resources/js/components/automation-rules/create-automation-rule-dialog.tsx index 400a77d2..de03c8cc 100644 --- a/resources/js/components/automation-rules/create-automation-rule-dialog.tsx +++ b/resources/js/components/automation-rules/create-automation-rule-dialog.tsx @@ -27,6 +27,7 @@ import { isValidRuleStructure, type RuleStructure, } from '@/lib/rule-builder-utils'; +import { automationRuleSyncService } from '@/services/automation-rule-sync'; import { categorySyncService } from '@/services/category-sync'; import type { Category } from '@/types/category'; import { router } from '@inertiajs/react'; @@ -119,7 +120,7 @@ export function CreateAutomationRuleDialog({ action_note_iv: noteIv, }, { - onSuccess: () => { + onSuccess: async () => { setOpen(false); setTitle(''); setPriority('0'); @@ -130,6 +131,7 @@ export function CreateAutomationRuleDialog({ setCategoryId(''); setNote(''); setErrors({}); + await automationRuleSyncService.sync(); onSuccess?.(); }, onError: (errors) => { diff --git a/resources/js/components/automation-rules/delete-automation-rule-dialog.tsx b/resources/js/components/automation-rules/delete-automation-rule-dialog.tsx index b6599be5..3d122dda 100644 --- a/resources/js/components/automation-rules/delete-automation-rule-dialog.tsx +++ b/resources/js/components/automation-rules/delete-automation-rule-dialog.tsx @@ -9,6 +9,7 @@ import { AlertDialogHeader, AlertDialogTitle, } from '@/components/ui/alert-dialog'; +import { automationRuleSyncService } from '@/services/automation-rule-sync'; import type { AutomationRule } from '@/types/automation-rule'; import { router } from '@inertiajs/react'; import { useState } from 'react'; @@ -28,11 +29,12 @@ export function DeleteAutomationRuleDialog({ }: DeleteAutomationRuleDialogProps) { const [isDeleting, setIsDeleting] = useState(false); - const handleDelete = () => { + const handleDelete = async () => { setIsDeleting(true); router.delete(destroy(rule.id).url, { - onSuccess: () => { + onSuccess: async () => { onOpenChange(false); + await automationRuleSyncService.sync(); onSuccess?.(); }, onFinish: () => { diff --git a/resources/js/components/automation-rules/edit-automation-rule-dialog.tsx b/resources/js/components/automation-rules/edit-automation-rule-dialog.tsx index 7048fd75..c3f02078 100644 --- a/resources/js/components/automation-rules/edit-automation-rule-dialog.tsx +++ b/resources/js/components/automation-rules/edit-automation-rule-dialog.tsx @@ -27,6 +27,7 @@ import { parseJsonLogic, type RuleStructure, } from '@/lib/rule-builder-utils'; +import { automationRuleSyncService } from '@/services/automation-rule-sync'; import { categorySyncService } from '@/services/category-sync'; import type { AutomationRule } from '@/types/automation-rule'; import type { Category } from '@/types/category'; @@ -157,9 +158,10 @@ export function EditAutomationRuleDialog({ action_note_iv: noteIv, }, { - onSuccess: () => { + onSuccess: async () => { onOpenChange(false); setErrors({}); + await automationRuleSyncService.sync(); onSuccess?.(); }, onError: (errors) => {