mirror of
https://github.com/zadam/trilium.git
synced 2025-11-10 15:25:51 +01:00
moved services into the service directory
This commit is contained in:
31
src/public/javascripts/services/sync.js
Normal file
31
src/public/javascripts/services/sync.js
Normal file
@@ -0,0 +1,31 @@
|
||||
"use strict";
|
||||
|
||||
import utils from './utils.js';
|
||||
|
||||
async function syncNow() {
|
||||
const result = await server.post('sync/now');
|
||||
|
||||
if (result.success) {
|
||||
utils.showMessage("Sync finished successfully.");
|
||||
}
|
||||
else {
|
||||
if (result.message.length > 50) {
|
||||
result.message = result.message.substr(0, 50);
|
||||
}
|
||||
|
||||
utils.showError("Sync failed: " + result.message);
|
||||
}
|
||||
}
|
||||
|
||||
$("#sync-now-button").click(syncNow);
|
||||
|
||||
async function forceNoteSync(noteId) {
|
||||
const result = await server.post('sync/force-note-sync/' + noteId);
|
||||
|
||||
utils.showMessage("Note added to sync queue.");
|
||||
}
|
||||
|
||||
export default {
|
||||
syncNow,
|
||||
forceNoteSync
|
||||
};
|
||||
Reference in New Issue
Block a user