added helpers.redirect

This commit is contained in:
barisusakli
2015-03-09 18:22:44 -04:00
parent f0ad2020df
commit ddd4680ea7
6 changed files with 43 additions and 47 deletions

View File

@@ -200,8 +200,7 @@ categoriesController.get = function(req, res, next) {
var topicCount = parseInt(results.categoryData.topic_count, 10);
if (topicIndex < 0 || topicIndex > Math.max(topicCount - 1, 0)) {
var url = '/category/' + cid + '/' + req.params.slug + (topicIndex > topicCount ? '/' + topicCount : '');
return res.locals.isAPI ? res.status(302).json(url) : res.redirect(url);
return helpers.redirect(res, '/category/' + cid + '/' + req.params.slug + (topicIndex > topicCount ? '/' + topicCount : ''));
}
userPrivileges = results.privileges;