From f71cb0e427a411822de4765f6d5c9b9de262b65b Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Thu, 11 Mar 2021 11:22:26 -0500 Subject: [PATCH] feat: pass interstital errors to individual partials as well as to registerComplete --- src/controllers/index.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/controllers/index.js b/src/controllers/index.js index 324d8609ed..12acaef9d6 100644 --- a/src/controllers/index.js +++ b/src/controllers/index.js @@ -204,15 +204,16 @@ Controllers.registerInterstitial = async function (req, res, next) { return helpers.redirect(res, returnTo || '/'); } + const errors = req.flash('errors'); const renders = data.interstitials.map( - interstitial => req.app.renderAsync(interstitial.template, interstitial.data || {}) + interstitial => req.app.renderAsync(interstitial.template, { ...interstitial.data || {}, errors }) ); const sections = await Promise.all(renders); res.render('registerComplete', { title: '[[pages:registration-complete]]', - errors: req.flash('errors'), sections: sections, + errors, }); } catch (err) { next(err);