fipamo/brain/routes/back/dash_posts.js

62 lines
1.6 KiB
JavaScript
Raw Normal View History

import DateUtils from '../../tools/utilities/DateUtils';
var express = require('express');
var router = express.Router();
var hljs = require('highlight.js/lib/highlight');
var hljs_md = require('highlight.js/lib/languages/markdown');
hljs.registerLanguage('markdown', hljs_md);
var Sequelize = require('sequelize');
const dateUtils = new DateUtils();
//--------------------------
// POSTS
//--------------------------
router.get('/list/:filter?/:page?', function(req, res) {
var pageNum = req.params.page;
2019-03-01 23:48:05 +01:00
var filter = req.params.filter;
if (pageNum == '' || pageNum == null) pageNum = 1;
2019-03-01 23:48:05 +01:00
if (filter == '' || filter == null) filter = 'all';
if (req.session.user) {
.then(() => {
//console.log(value);
})
.catch(() => {
//next(err);
});
} else {
res.redirect('/@/dashboard');
}
});
//--------------------------
// BLOG POST ADD DISPLAY
//--------------------------
router.get('/add/new', function(req, res) {
if (req.session.user) {
res.render('dash/post-edit', {
title: 'Dashboard New Post',
user_status: true,
welcome: 'New Post',
mode: 'admin',
date:
dateUtils.getDate('year', new Date()) +
'-' +
dateUtils.getDate('month', new Date()) +
'-' +
dateUtils.getDate('day', new Date()),
status: ['false', 'false', 'false'],
edit: false
});
} else {
res.redirect('/@/dashboard');
}
});
//--------------------------
// BLOG POST EDIT DISPLAY
//--------------------------
router.get('/edit/:id', function(req, res) {
if (req.session.user) {
} else {
res.redirect('/@/dashboard');
}
});
module.exports = router;