From f7542b7c0e913861a02ba4ba15c6242d36ababee Mon Sep 17 00:00:00 2001 From: marsalva Date: Wed, 11 Feb 2026 08:10:42 +0000 Subject: [PATCH] Actualizar configuracion.html --- configuracion.html | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/configuracion.html b/configuracion.html index c26409c..42b2835 100644 --- a/configuracion.html +++ b/configuracion.html @@ -351,4 +351,20 @@ app.put("/admin/users/:id", authMiddleware, async (req, res) => { const client = app.delete("/admin/users/:id", authMiddleware, async (req, res) => { try { await pool.query("DELETE FROM users WHERE id=$1 AND owner_id=$2", [req.params.id, req.user.accountId]); res.json({ ok: true }); } catch (e) { res.status(500).json({ ok: false }); } }); const port = process.env.PORT || 3000; -autoUpdateDB().then(() => { app.listen(port, "0.0.0.0", () => console.log(`🚀 Server OK en puerto ${port}`)); }); \ No newline at end of file +autoUpdateDB().then(() => { app.listen(port, "0.0.0.0", () => console.log(`🚀 Server OK en puerto ${port}`)); }); + +async function deleteStatus(id) { + if(!confirm("¿Borrar estado?")) return; + try { + const res = await fetch(`${API_URL}/statuses/${id}`, { method: 'DELETE', headers: { "Authorization": `Bearer ${localStorage.getItem("token")}` } }); + const json = await res.json(); + + if(res.ok) { + showToast("Estado eliminado"); + loadStatusesConfig(); + } else { + // Muestra el mensaje de error específico que envía el servidor + showToast(json.error || "No se pudo borrar", true); + } + } catch(e) { showToast("Error de conexión", true); } + } \ No newline at end of file