From 5ed4787e33e258cc9afa7e9d2886a0b590d69715 Mon Sep 17 00:00:00 2001 From: Mateja Date: Sun, 9 May 2021 14:41:41 +0200 Subject: Returning validation errors and old values to `post` form. Made custom middleware for that purpose. --- controllers/post.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'controllers') 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'); }); }, -- cgit v1.2.3