Prevent trying to update items that are not in the database
This commit is contained in:
parent
0a29a078f6
commit
b05d59b318
4
app.js
4
app.js
|
@ -330,6 +330,10 @@ app.get('/draggables/:id', function(req, res) {
|
||||||
// i.e. the global state.
|
// i.e. the global state.
|
||||||
app.post('/draggables/:id', function(req, res) {
|
app.post('/draggables/:id', function(req, res) {
|
||||||
var drag = draggables[req.params.id];
|
var drag = draggables[req.params.id];
|
||||||
|
if (!drag) {
|
||||||
|
res.send(false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (req.body.title) {
|
if (req.body.title) {
|
||||||
// It's a title update!
|
// It's a title update!
|
||||||
console.log("Title update for draggable " + req.params.id + ": " +
|
console.log("Title update for draggable " + req.params.id + ": " +
|
||||||
|
|
Reference in New Issue