fehlermeldungen gebaut

This commit is contained in:
ecki
2026-04-05 18:15:53 +02:00
parent 80b96319ee
commit 8aa85d47a7
8 changed files with 76 additions and 35 deletions
+21 -17
View File
@@ -35,24 +35,28 @@ exports.remove = async (req, res) => {
};
exports.update = async (req, res) => {
try {
const { ip, type, comment } = req.body
try{
const {ip, type, comment} = req.body;
await db.query(
"UPDATE resource_ips SET ip=?, type=?, comment=? WHERE id=?",
[ip, type, comment, req.params.id]
);
res.json({success:true});
}catch(e){
console.error("UPDATE IP error:", e);
res.status(500).json({error:"DB error"});
if (!ip) {
return res.status(400).json({ error: "IP darf nicht leer sein" })
}
};
await db.query(
"UPDATE resource_ips SET ip=?, type=?, comment=? WHERE id=?",
[ip, type, comment, req.params.id]
)
res.json({ success: true })
} catch (e) {
console.error("UPDATE IP error:", e)
res.status(500).json({
error: "IP konnte nicht gespeichert werden"
})
}
}