trilium/src/public/javascripts/services/sync.js

30 lines
703 B
JavaScript
Raw Normal View History

import utils from './utils.js';
2018-03-26 09:29:35 +08:00
import infoService from "./info.js";
async function syncNow() {
const result = await server.post('sync/now');
if (result.success) {
2018-03-26 09:29:35 +08:00
infoService.showMessage("Sync finished successfully.");
}
else {
if (result.message.length > 50) {
result.message = result.message.substr(0, 50);
}
2018-03-26 09:29:35 +08:00
infoService.showError("Sync failed: " + result.message);
}
}
$("#sync-now-button").click(syncNow);
async function forceNoteSync(noteId) {
const result = await server.post('sync/force-note-sync/' + noteId);
2018-03-26 09:29:35 +08:00
infoService.showMessage("Note added to sync queue.");
}
export default {
syncNow,
forceNoteSync
};