2017-11-04 19:38:50 -04:00
|
|
|
"use strict";
|
|
|
|
|
2017-10-29 11:22:41 -04:00
|
|
|
function syncNow() {
|
|
|
|
$.ajax({
|
|
|
|
url: baseApiUrl + 'sync/now',
|
|
|
|
type: 'POST',
|
|
|
|
success: result => {
|
|
|
|
if (result.success) {
|
2017-11-04 19:35:39 -04:00
|
|
|
status.checkStatus();
|
2017-10-29 16:14:59 -04:00
|
|
|
|
2017-11-08 22:33:08 -05:00
|
|
|
showMessage("Sync finished successfully.");
|
2017-10-29 11:22:41 -04:00
|
|
|
}
|
|
|
|
else {
|
2017-11-04 21:21:09 -04:00
|
|
|
if (result.message.length > 50) {
|
|
|
|
result.message = result.message.substr(0, 50);
|
|
|
|
}
|
|
|
|
|
2017-11-08 22:33:08 -05:00
|
|
|
showError("Sync failed: " + result.message);
|
2017-10-29 11:22:41 -04:00
|
|
|
}
|
|
|
|
},
|
2017-11-08 22:33:08 -05:00
|
|
|
error: () => showError("Sync failed for unknown reason.")
|
2017-10-29 11:22:41 -04:00
|
|
|
});
|
|
|
|
}
|