added a check for res.locals.isAPI inside res.render, instead of doing it all over the place in code

v1.18.x
psychobunny 11 years ago
parent 1b3f089804
commit faf3de7e27

@ -80,11 +80,7 @@ Controllers.home = function(req, res, next) {
});
}
}, function (err, data) {
if (res.locals.isAPI) {
res.json(data);
} else {
res.render('home', data);
}
res.render('home', data);
});
};

@ -276,6 +276,10 @@ middleware.processRender = function(req, res, next) {
fn = defaultFn;
}
if (res.locals.isAPI) {
return res.json(options);
}
render.call(self, template, options, function(err, str) {
if (res.locals.footer) {
str = str + res.locals.footer;

Loading…
Cancel
Save