1
0
Fork 0
mirror of https://github.com/codex-team/codex.docs.git synced 2025-08-08 15:05:26 +02:00

fix error message on catch

This commit is contained in:
Murod Khaydarov 2019-01-17 21:40:44 +03:00
parent d3fc839d04
commit 79e4c755a9
No known key found for this signature in database
GPG key ID: C480BA53A8D274C5
2 changed files with 11 additions and 3 deletions

View file

@ -56,14 +56,11 @@ module.exports = asyncMiddleware(async function (req, res, next) {
* @type {string}
*/
const parentIdOfRootPages = '0';
try {
const rootPages = await PagesOrder.get(parentIdOfRootPages);
res.locals.menu = await createMenuTree(rootPages.order, 2);
} catch (error) {
console.log('Can not load menu:', error);
}
next();
});

View file

@ -3,4 +3,15 @@ const config = require('../../../config');
const db = new Datastore({filename: `./${config.database}/pagesOrder.db`, autoload: true});
/**
* Add initial row for RootPage
*/
(async function() {
const initialData = {
page: '0',
order: []
};
await db.insert(initialData);
}());
module.exports = db;