mirror of
				https://github.com/zadam/trilium.git
				synced 2025-11-03 20:06:08 +01:00 
			
		
		
		
	
		
			
				
	
	
		
			23 lines
		
	
	
		
			601 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			23 lines
		
	
	
		
			601 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
"use strict";
 | 
						|
 | 
						|
function syncNow() {
 | 
						|
    $.ajax({
 | 
						|
        url: baseApiUrl + 'sync/now',
 | 
						|
        type: 'POST',
 | 
						|
        success: result => {
 | 
						|
            if (result.success) {
 | 
						|
                status.checkStatus();
 | 
						|
 | 
						|
                showMessage("Sync finished successfully.");
 | 
						|
            }
 | 
						|
            else {
 | 
						|
                if (result.message.length > 50) {
 | 
						|
                    result.message = result.message.substr(0, 50);
 | 
						|
                }
 | 
						|
 | 
						|
                showError("Sync failed: " + result.message);
 | 
						|
            }
 | 
						|
        },
 | 
						|
        error: () => showError("Sync failed for unknown reason.")
 | 
						|
    });
 | 
						|
} |