diff --git a/api/routes/wars.js b/api/routes/wars.js index 8506b7d..ecb4d8d 100644 --- a/api/routes/wars.js +++ b/api/routes/wars.js @@ -129,10 +129,12 @@ wars.route('/:id') WarModel.findByIdAndRemove(req.params.id, (err, item) => { if (err) { err.status = codes.wrongrequest; + return next(err); } else if (!item) { err = new Error("item not found"); err.status = codes.notfound; + return next(err); } //TODO: add removal of resource files @@ -142,7 +144,7 @@ wars.route('/:id') // we don't set res.locals.items and thus it will send a 204 (no content) at the end. see last handler user.use(..) res.locals.processed = true; - next(err); // this works because err is in normal case undefined and that is the same as no parameter + next(); }) }) diff --git a/static/src/app/army/army.component.html b/static/src/app/army/army.component.html index 7ecee78..7f09601 100644 --- a/static/src/app/army/army.component.html +++ b/static/src/app/army/army.component.html @@ -1,6 +1,6 @@