chore: Auto reload frontend of client is out of date (#1270)

* Move editor version to header
Add editor version check for API endpoints

* fix: Editor update auto-reload
Bump RME

* fix: Only redirect if editor header exists

* lint
This commit is contained in:
Tom Moor
2020-05-16 14:05:51 -07:00
committed by GitHub
parent 82749ffbd8
commit e0b33ee576
6 changed files with 36 additions and 5 deletions

View File

@ -692,12 +692,13 @@ router.post('documents.create', auth(), async ctx => {
const {
title = '',
text = '',
editorVersion,
publish,
collectionId,
parentDocumentId,
index,
} = ctx.body;
const editorVersion = ctx.headers['x-editor-version'];
ctx.assertUuid(collectionId, 'collectionId must be an uuid');
if (parentDocumentId) {
ctx.assertUuid(parentDocumentId, 'parentDocumentId must be an uuid');
@ -787,10 +788,11 @@ router.post('documents.update', auth(), async ctx => {
publish,
autosave,
done,
editorVersion,
lastRevision,
append,
} = ctx.body;
const editorVersion = ctx.headers['x-editor-version'];
ctx.assertPresent(id, 'id is required');
ctx.assertPresent(title || text, 'title or text is required');
if (append) ctx.assertPresent(text, 'Text is required while appending');