|
|
|
@ -9,6 +9,7 @@ const fs = require('fs-extra');
|
|
|
|
|
const moment = require('moment');
|
|
|
|
|
const book = new Book();
|
|
|
|
|
const nav = new Navigation();
|
|
|
|
|
const auth = new Auth();
|
|
|
|
|
const _ = require('lodash');
|
|
|
|
|
const uploadPath =
|
|
|
|
|
'./public/assets/images/blog/' + moment().format('YYYY') + '/' + moment().format('MM');
|
|
|
|
@ -46,8 +47,7 @@ router.get('/', (req, res) => {
|
|
|
|
|
* Add/Update Page
|
|
|
|
|
*/
|
|
|
|
|
router.post('/write/:task?', feature_upload, (req, res) => {
|
|
|
|
|
if (req.session.user) {
|
|
|
|
|
Auth.authCheck(req)
|
|
|
|
|
auth.authCheck(req)
|
|
|
|
|
.then(() => {
|
|
|
|
|
let body = _.mapValues(req.body);
|
|
|
|
|
let feature = '';
|
|
|
|
@ -80,7 +80,6 @@ router.post('/write/:task?', feature_upload, (req, res) => {
|
|
|
|
|
.catch(err => {
|
|
|
|
|
res.json(err);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -88,8 +87,7 @@ router.post('/write/:task?', feature_upload, (req, res) => {
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
router.post('/delete', (req, res) => {
|
|
|
|
|
if (req.session.user) {
|
|
|
|
|
Auth.authCheck(req)
|
|
|
|
|
auth.authCheck(req)
|
|
|
|
|
.then(() => {
|
|
|
|
|
book.editPage([], req.body.id, DataEvent.API_PAGE_DELETE, req.session.user)
|
|
|
|
|
.then(result => {
|
|
|
|
@ -103,7 +101,6 @@ router.post('/delete', (req, res) => {
|
|
|
|
|
.catch(err => {
|
|
|
|
|
res.json(err);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|