diff --git a/src/routes/_authenticated/archivos.tsx b/src/routes/_authenticated/archivos.tsx index d4ed468..3449974 100644 --- a/src/routes/_authenticated/archivos.tsx +++ b/src/routes/_authenticated/archivos.tsx @@ -72,6 +72,21 @@ function RouteComponent() { .delete() .eq("documentos_id", id) if (error) return alert(error.message) + + try { + const res = await fetch(`${import.meta.env.VITE_BACK_ORIGIN}/api/eliminar/documento`, { + method: "DELETE", + headers: { "Content-Type": "application/json" }, + body: JSON.stringify({ documentos_id: id }), + }) + + if (!res.ok) { + throw new Error("Se falló al eliminar el documento") + } + } catch (err) { + console.error("Error al eliminar el documento:", err) + } + router.invalidate() }