|
|
|
@ -1,6 +1,6 @@
|
|
|
|
|
import Book from '../../data/Book';
|
|
|
|
|
import Auth from '../../data/Auth';
|
|
|
|
|
import Navigation from '../../data/Navigation';
|
|
|
|
|
import Settings from '../../data/Settings';
|
|
|
|
|
import * as DataEvent from '../../../src/com/events/DataEvent';
|
|
|
|
|
const express = require('express');
|
|
|
|
|
const router = express.Router();
|
|
|
|
@ -8,8 +8,8 @@ const multer = require('multer');
|
|
|
|
|
const fs = require('fs-extra');
|
|
|
|
|
const moment = require('moment');
|
|
|
|
|
const book = new Book();
|
|
|
|
|
const nav = new Navigation();
|
|
|
|
|
const auth = new Auth();
|
|
|
|
|
const settings = new Settings();
|
|
|
|
|
const _ = require('lodash');
|
|
|
|
|
const uploadPath =
|
|
|
|
|
'./public/assets/images/blog/' + moment().format('YYYY') + '/' + moment().format('MM');
|
|
|
|
@ -68,8 +68,8 @@ router.post('/write/:task?', feature_upload, (req, res) => {
|
|
|
|
|
body.deleted = false;
|
|
|
|
|
book.editPage(body, body.page_uuid, task, req.session.user)
|
|
|
|
|
.then(result => {
|
|
|
|
|
if (result.type === DataEvent.PAGE_CREATE) {
|
|
|
|
|
nav.updatePageStats();
|
|
|
|
|
if (result.type === DataEvent.PAGE_ADDED) {
|
|
|
|
|
settings.updatePageIndex();
|
|
|
|
|
}
|
|
|
|
|
res.json(result);
|
|
|
|
|
})
|
|
|
|
|