1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-10-20 07:40:57 +02:00
bitwarden-browser/src/popup/app/settings/settingsSyncController.js

29 lines
850 B
JavaScript
Raw Normal View History

angular
.module('bit.settings')
2016-09-22 01:30:08 +02:00
.controller('settingsSyncController', function ($scope, syncService, toastr) {
$scope.lastSync = '--';
2016-09-22 02:21:54 +02:00
$scope.loading = false;
2016-09-22 01:30:08 +02:00
setLastSync();
2016-09-22 01:30:08 +02:00
$scope.sync = function () {
2016-09-22 02:21:54 +02:00
$scope.loading = true;
2016-09-22 01:30:08 +02:00
syncService.fullSync(function () {
2016-09-22 02:21:54 +02:00
$scope.loading = false;
2016-09-22 01:30:08 +02:00
toastr.success('Syncing complete');
setLastSync();
});
};
function setLastSync() {
syncService.getLastSync(function (lastSync) {
if (lastSync) {
$scope.lastSync = lastSync.toLocaleDateString() + ' ' + lastSync.toLocaleTimeString();
}
else {
$scope.lastSync = 'Never';
}
});
}
});