mirror of
https://github.com/zadam/trilium.git
synced 2024-11-18 05:35:56 +08:00
30 lines
No EOL
690 B
JavaScript
30 lines
No EOL
690 B
JavaScript
import server from './server.js';
|
|
import infoService from "./info.js";
|
|
|
|
async function syncNow() {
|
|
const result = await server.post('sync/now');
|
|
|
|
if (result.success) {
|
|
infoService.showMessage("Sync finished successfully.");
|
|
}
|
|
else {
|
|
if (result.message.length > 50) {
|
|
result.message = result.message.substr(0, 50);
|
|
}
|
|
|
|
infoService.showError("Sync failed: " + result.message);
|
|
}
|
|
}
|
|
|
|
$("#sync-now-button").click(syncNow);
|
|
|
|
async function forceNoteSync(noteId) {
|
|
await server.post('sync/force-note-sync/' + noteId);
|
|
|
|
infoService.showMessage("Note added to sync queue.");
|
|
}
|
|
|
|
export default {
|
|
syncNow,
|
|
forceNoteSync
|
|
}; |