optimized widget call by bundling all queries into one for #1428; fixes active users widget crash

also fixes b3819fd076 properly
This commit is contained in:
psychobunny
2014-07-09 19:23:03 -04:00
parent 9fbd535b79
commit 5b6acbad1e
5 changed files with 19 additions and 10 deletions

View File

@@ -81,10 +81,15 @@ apiController.getConfig = function(req, res, next) {
apiController.renderWidgets = function(req, res, next) {
var uid = req.user ? req.user.uid : 0,
area = {
template: req.params.template + '.tpl',
location: req.params.location
template: req.query.template,
location: req.query.location,
url: req.query.url
};
if (!area.template || !area.location) {
return res.json(200, {});
}
widgets.render(uid, area, function(err, data) {
res.json(200, data);
});