Actualizar configuracion.html
This commit is contained in:
@@ -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 }); } });
|
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;
|
const port = process.env.PORT || 3000;
|
||||||
autoUpdateDB().then(() => { app.listen(port, "0.0.0.0", () => console.log(`🚀 Server OK en puerto ${port}`)); });
|
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); }
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user