fix: synchronize cronjob deletion server-side (#11)

This commit is contained in:
Felipe Domingues 2026-05-30 14:56:38 -03:00 committed by GitHub
parent 792aa697b5
commit fd06a4bb07
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 256 additions and 16 deletions

View file

@ -68,14 +68,13 @@ export function CronjobCard({ job }: Props) {
async function remove() {
try {
await deleteMut.mutateAsync(job.id);
toast.success("Automação excluída.");
setConfirmDelete(false);
const { error: syncError } = await syncAgentRuntime(job.agent_instance_id, "cronjobs");
if (syncError) {
toast.warning("Automação removida, mas o runtime do agente não sincronizou.");
const result = await deleteMut.mutateAsync(job.id);
if (result.runtime_sync_warning) {
toast.warning("Automação removida do painel; limpeza final do runtime pendente.");
} else {
toast.success("Automação excluída.");
}
setConfirmDelete(false);
} catch (e) {
toast.error(e instanceof Error ? e.message : "Erro ao excluir.");
}