fehlermeldungen gebaut
This commit is contained in:
@@ -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"
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user