mirror of
https://github.com/zadam/trilium.git
synced 2026-01-18 12:34:24 +01:00
31 lines
785 B
JavaScript
31 lines
785 B
JavaScript
import server from './server.js';
|
|
import toastService from "./toast.js";
|
|
|
|
async function syncNow(ignoreNotConfigured = false) {
|
|
const result = await server.post('sync/now');
|
|
|
|
if (result.success) {
|
|
toastService.showMessage("Sync finished successfully.");
|
|
}
|
|
else {
|
|
if (result.message.length > 200) {
|
|
result.message = `${result.message.substr(0, 200)}...`;
|
|
}
|
|
|
|
if (!ignoreNotConfigured || result.errorCode !== 'NOT_CONFIGURED') {
|
|
toastService.showError(`Sync failed: ${result.message}`);
|
|
}
|
|
}
|
|
}
|
|
|
|
async function forceNoteSync(noteId) {
|
|
await server.post(`sync/force-note-sync/${noteId}`);
|
|
|
|
toastService.showMessage("Note added to sync queue.");
|
|
}
|
|
|
|
export default {
|
|
syncNow,
|
|
forceNoteSync
|
|
};
|