API endpoint accepts autosave

This commit is contained in:
Tom Moor
2018-05-06 22:13:52 -07:00
parent f887a8383b
commit 67f2b3cce4
5 changed files with 57 additions and 25 deletions

View File

@@ -334,7 +334,7 @@ router.post('documents.create', auth(), async ctx => {
});
router.post('documents.update', auth(), async ctx => {
const { id, title, text, publish, done, lastRevision } = ctx.body;
const { id, title, text, publish, autosave, done, lastRevision } = ctx.body;
ctx.assertPresent(id, 'id is required');
ctx.assertPresent(title || text, 'title or text is required');
@@ -355,7 +355,7 @@ router.post('documents.update', auth(), async ctx => {
if (publish) {
await document.publish();
} else {
await document.save();
await document.save({ autosave });
if (document.publishedAt && done) {
events.add({ name: 'documents.update', model: document });