aboutsummaryrefslogtreecommitdiff
path: root/controllers
diff options
context:
space:
mode:
authorMateja <mail@matejamaric.com>2021-05-09 14:41:41 +0200
committerMateja <mail@matejamaric.com>2021-05-09 14:41:41 +0200
commit5ed4787e33e258cc9afa7e9d2886a0b590d69715 (patch)
treeaaad7a8e13ea08b7d548ede3a799d848efb1c730 /controllers
parent766b60adf81664c59bda39ebc5350af67e325f4e (diff)
downloadnode-playground-5ed4787e33e258cc9afa7e9d2886a0b590d69715.tar.gz
node-playground-5ed4787e33e258cc9afa7e9d2886a0b590d69715.zip
Returning validation errors and old values to `post` form.
Made custom middleware for that purpose.
Diffstat (limited to 'controllers')
-rw-r--r--controllers/post.js2
1 files changed, 1 insertions, 1 deletions
diff --git a/controllers/post.js b/controllers/post.js
index 45da525..30d0002 100644
--- a/controllers/post.js
+++ b/controllers/post.js
@@ -30,7 +30,7 @@ module.exports = {
newPost.save()
.then(() => res.redirect('/'))
.catch(err => {
- console.log(err);
+ req.setOldForm(err);
res.redirect('/new-post');
});
},