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