trilium/src/public/javascripts/services/sync.js
2019-11-09 17:39:48 +01:00

30 lines
No EOL
701 B
JavaScript

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