FormHelperComponent: don't flash empty previous form data

This commit is contained in:
Alice Gaudon 2021-01-25 17:26:29 +01:00
parent 5caa0be862
commit aed825c4d6

View File

@ -37,7 +37,7 @@ export default class FormHelperComponent extends ApplicationComponent {
router.use((req, res, next) => { router.use((req, res, next) => {
if (['GET', 'POST'].find(m => m === req.method)) { if (['GET', 'POST'].find(m => m === req.method)) {
if (typeof req.body === 'object') { if (typeof req.body === 'object' && Object.keys(req.body).length > 0) {
req.flash('previousFormData', req.body); req.flash('previousFormData', req.body);
} }
} }