feat(Flash): Add render methods that do not dump flash autom
query from the front end app for these messages
This commit is contained in:
@@ -9,14 +9,15 @@ module.exports = function(app) {
|
||||
var router = app.loopback.Router();
|
||||
router.get('/', addDefaultImage, index);
|
||||
app.use(
|
||||
'/:lang',
|
||||
(req, res, next) => {
|
||||
// add url language to request for all routers
|
||||
req._urlLang = req.params.lang;
|
||||
next();
|
||||
},
|
||||
router
|
||||
);
|
||||
'/:lang',
|
||||
(req, res, next) => {
|
||||
// add url language to request for all routers
|
||||
req._urlLang = req.params.lang;
|
||||
next();
|
||||
},
|
||||
router
|
||||
);
|
||||
|
||||
app.use(router);
|
||||
|
||||
function addDefaultImage(req, res, next) {
|
||||
|
||||
5
server/boot/react.js
vendored
5
server/boot/react.js
vendored
@@ -95,8 +95,9 @@ export default function reactSubRouter(app) {
|
||||
const title = titleSelector(state);
|
||||
epic.dispose();
|
||||
res.expose(state, 'data', { isJSON: true });
|
||||
res.expose(req.flash(), 'flash', { isJSON: true });
|
||||
res.render('layout-react', { markup, title });
|
||||
// note(berks): we render without express-flash dumping our messages
|
||||
// the app will query for these on load
|
||||
res.renderWithoutFlash('layout-react', { markup, title });
|
||||
})
|
||||
.subscribe(() => log('html rendered and sent'), next);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user