mirror of
https://github.com/codex-team/codex.docs.git
synced 2025-08-08 06:55:26 +02:00
fix error message on catch
This commit is contained in:
parent
d3fc839d04
commit
79e4c755a9
2 changed files with 11 additions and 3 deletions
|
@ -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();
|
||||
});
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue