Better flash
This commit is contained in:
parent
d2351c6eb5
commit
e68d1047aa
2 changed files with 5 additions and 4 deletions
|
@ -1,7 +1,5 @@
|
||||||
const config = require('../config');
|
const config = require('../config');
|
||||||
module.exports = (req, res, next) => {
|
module.exports = (req, res, next) => {
|
||||||
res.locals.successes = req.flash('success');
|
|
||||||
res.locals.errors = req.flash('error');
|
|
||||||
res.locals.config = config;
|
res.locals.config = config;
|
||||||
res.locals.req = req;
|
res.locals.req = req;
|
||||||
next();
|
next();
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
|
- successes = req.flash('success');
|
||||||
|
- errors = req.flash('error');
|
||||||
|
|
||||||
if successes
|
if successes
|
||||||
each success in successes
|
each success in successes
|
||||||
p.has-text-success= success
|
p.has-text-success= (success.toString().startsWith('[object ') ? JSON.stringify(success) : success.toString())
|
||||||
if errors
|
if errors
|
||||||
each error in errors
|
each error in errors
|
||||||
p.has-text-danger= error
|
p.has-text-danger= (error.toString().startsWith('[object ') ? JSON.stringify(error) : error.toString())
|
Loading…
Reference in a new issue