refactor: make categories.buildForSelectCategories non async

This commit is contained in:
Barış Soner Uşaklı
2019-09-10 23:44:08 -04:00
parent 09410ff1c5
commit 6cda369872
3 changed files with 13 additions and 28 deletions

View File

@@ -11,7 +11,7 @@ categoriesController.get = async function (req, res, next) {
const [categoryData, parent, allCategories] = await Promise.all([
categories.getCategories([req.params.category_id], req.uid),
categories.getParents([req.params.category_id]),
getAllCategories(req.uid),
categories.buildForSelectAll(req.uid),
]);
const category = categoryData[0];
@@ -43,13 +43,6 @@ categoriesController.get = async function (req, res, next) {
});
};
async function getAllCategories(uid) {
const cids = await categories.getAllCidsFromSet('categories:cid');
const categoryData = await categories.getCategories(cids, uid);
const tree = categories.getTree(categoryData);
return await categories.buildForSelectCategories(tree);
}
categoriesController.getAll = function (req, res) {
// Categories list will be rendered on client side with recursion, etc.
res.render('admin/manage/categories', {});