Actualizar configuracion.html
This commit is contained in:
@@ -352,3 +352,19 @@ app.delete("/admin/users/:id", authMiddleware, async (req, res) => { try { await
|
||||
|
||||
const port = process.env.PORT || 3000;
|
||||
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