forked from projects/fipamo
34 lines
822 B
JavaScript
34 lines
822 B
JavaScript
import Pages from '../../utils/content/Pages';
|
|
|
|
const express = require('express');
|
|
const router = express.Router();
|
|
const settings = require('../../../config/site-settings.json');
|
|
|
|
//--------------------------
|
|
// Index
|
|
//--------------------------
|
|
router.get('/', function(req, res) {
|
|
let pages = new Pages();
|
|
pages.retrieve().then(result => {
|
|
let pageData = [];
|
|
if (req.session.user) {
|
|
pageData = { title: settings.title, status: true, pages: result };
|
|
} else {
|
|
pageData = { title: settings.title, status: false, pages: result };
|
|
}
|
|
|
|
res.render(settings.admin_theme + '/index', pageData);
|
|
});
|
|
});
|
|
|
|
//--------------------------
|
|
// Logout
|
|
//--------------------------
|
|
router.post('/logout', function(req, res) {
|
|
req.logout();
|
|
return res.json({
|
|
message: 'LOGGED OUT'
|
|
});
|
|
});
|
|
module.exports = router;
|