2019-05-17 04:11:10 +08:00
|
|
|
import { check } from 'meteor/check';
|
|
|
|
import { getDataFromChangeset } from '/imports/api/captions/server/helpers';
|
|
|
|
import updatePad from '/imports/api/captions/server/modifiers/updatePad';
|
|
|
|
|
|
|
|
export default function handlePadUpdate({ body }) {
|
|
|
|
const { pad, revs, changeset } = body;
|
|
|
|
const { id } = pad;
|
|
|
|
|
|
|
|
check(id, String);
|
|
|
|
check(changeset, String);
|
|
|
|
check(revs, Number);
|
|
|
|
|
|
|
|
const data = getDataFromChangeset(changeset);
|
|
|
|
|
2019-05-29 22:31:27 +08:00
|
|
|
if (data !== '') {
|
2019-05-17 04:11:10 +08:00
|
|
|
updatePad(id, data, revs);
|
|
|
|
}
|
|
|
|
}
|