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:
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}
|
* @type {string}
|
||||||
*/
|
*/
|
||||||
const parentIdOfRootPages = '0';
|
const parentIdOfRootPages = '0';
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const rootPages = await PagesOrder.get(parentIdOfRootPages);
|
const rootPages = await PagesOrder.get(parentIdOfRootPages);
|
||||||
|
|
||||||
res.locals.menu = await createMenuTree(rootPages.order, 2);
|
res.locals.menu = await createMenuTree(rootPages.order, 2);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log('Can not load menu:', error);
|
console.log('Can not load menu:', error);
|
||||||
}
|
}
|
||||||
|
|
||||||
next();
|
next();
|
||||||
});
|
});
|
||||||
|
|
|
@ -3,4 +3,15 @@ const config = require('../../../config');
|
||||||
|
|
||||||
const db = new Datastore({filename: `./${config.database}/pagesOrder.db`, autoload: true});
|
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;
|
module.exports = db;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue