|
|
|
@ -78,8 +78,8 @@ router.get('/list/:filter?/:page?', function (req, res) {
|
|
|
|
|
.then(() => {
|
|
|
|
|
//console.log(value);
|
|
|
|
|
})
|
|
|
|
|
.catch(() => {
|
|
|
|
|
//next(err);
|
|
|
|
|
.catch(err => {
|
|
|
|
|
res.render('error', { error: err });
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
res.redirect('/@/dashboard');
|
|
|
|
@ -92,10 +92,7 @@ router.get('/list/:filter?/:page?', function (req, res) {
|
|
|
|
|
router.get('/add/new', function (req, res) {
|
|
|
|
|
if (req.session.user) {
|
|
|
|
|
//need to grab a few copy of settings for the lastest index
|
|
|
|
|
fs.ensureDir(
|
|
|
|
|
'./public/assets/images/blog/' + moment().format('YYYY') + '/' + moment().format('MM'),
|
|
|
|
|
() => {
|
|
|
|
|
fs.readJSON('site/settings.json')
|
|
|
|
|
fs.readJSON('site/settings.jso')
|
|
|
|
|
.then(config => {
|
|
|
|
|
res.render('page-edit', {
|
|
|
|
|
id: config.library_stats.current_index,
|
|
|
|
@ -110,9 +107,9 @@ router.get('/add/new', function (req, res) {
|
|
|
|
|
edit: false
|
|
|
|
|
});
|
|
|
|
|
})
|
|
|
|
|
.catch(err => {}); //render error page
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
.catch(err => {
|
|
|
|
|
res.render('error', { error: err });
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
res.redirect('/@/dashboard');
|
|
|
|
|
}
|
|
|
|
@ -145,7 +142,7 @@ router.get('/edit/:id', function (req, res) {
|
|
|
|
|
});
|
|
|
|
|
})
|
|
|
|
|
.catch(err => {
|
|
|
|
|
res.json({ type: err });
|
|
|
|
|
res.render('error', { error: err });
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
res.redirect('/@/dashboard');
|
|
|
|
|