mirror of
https://github.com/domfelipe/mika-agent-assist.git
synced 2026-08-07 07:36:41 +00:00
Changes
Co-authored-by: domfelipe <53182096+domfelipe@users.noreply.github.com>
This commit is contained in:
parent
9d0e839508
commit
7c541f3459
1 changed files with 11 additions and 2 deletions
|
|
@ -181,8 +181,17 @@ export function useDeleteCronjob() {
|
||||||
const qc = useQueryClient();
|
const qc = useQueryClient();
|
||||||
return useMutation({
|
return useMutation({
|
||||||
mutationFn: async (id: string) => {
|
mutationFn: async (id: string) => {
|
||||||
const { error } = await supabase.from("scheduled_jobs").delete().eq("id", id);
|
const { data, error } = await invokeFunction<{
|
||||||
if (error) throw error;
|
success: boolean;
|
||||||
|
job_id: string;
|
||||||
|
agent_instance_id: string;
|
||||||
|
archived: boolean;
|
||||||
|
deleted: boolean;
|
||||||
|
runtime_sync_warning: string | null;
|
||||||
|
}>("delete-cronjob", { job_id: id });
|
||||||
|
if (error) throw new Error(error.message);
|
||||||
|
if (!data?.success) throw new Error("Erro ao excluir automação.");
|
||||||
|
return data;
|
||||||
},
|
},
|
||||||
onSuccess: () => {
|
onSuccess: () => {
|
||||||
qc.invalidateQueries({ queryKey: ["cronjobs"] });
|
qc.invalidateQueries({ queryKey: ["cronjobs"] });
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue