mirror of
https://github.com/zadam/trilium.git
synced 2025-11-02 11:26:15 +01:00
using server.method() instead of direct call to $.ajax - preparation for electron without network requests
This commit is contained in:
@@ -1,21 +1,16 @@
|
||||
"use strict";
|
||||
|
||||
function syncNow() {
|
||||
$.ajax({
|
||||
url: baseApiUrl + 'sync/now',
|
||||
type: 'POST',
|
||||
success: result => {
|
||||
if (result.success) {
|
||||
showMessage("Sync finished successfully.");
|
||||
}
|
||||
else {
|
||||
if (result.message.length > 50) {
|
||||
result.message = result.message.substr(0, 50);
|
||||
}
|
||||
async function syncNow() {
|
||||
const result = await server.post('sync/now');
|
||||
|
||||
showError("Sync failed: " + result.message);
|
||||
}
|
||||
},
|
||||
error: () => showError("Sync failed for unknown reason.")
|
||||
});
|
||||
if (result.success) {
|
||||
showMessage("Sync finished successfully.");
|
||||
}
|
||||
else {
|
||||
if (result.message.length > 50) {
|
||||
result.message = result.message.substr(0, 50);
|
||||
}
|
||||
|
||||
showError("Sync failed: " + result.message);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user