mirror of
https://github.com/bitwarden/browser
synced 2025-12-18 17:23:37 +00:00
cleanup and formatting
This commit is contained in:
@@ -7,36 +7,31 @@ class SyncController {
|
||||
|
||||
constructor(private syncService: any, private toastr: any, private $analytics: any, private i18nService: any) {
|
||||
this.i18n = i18nService;
|
||||
|
||||
this.setLastSync();
|
||||
}
|
||||
|
||||
sync() {
|
||||
this.loading = true;
|
||||
this.syncService
|
||||
.fullSync(true)
|
||||
.then((success: boolean) => {
|
||||
this.loading = false;
|
||||
if (success) {
|
||||
this.setLastSync();
|
||||
this.$analytics.eventTrack('Synced Full');
|
||||
this.toastr.success(this.i18nService.syncingComplete);
|
||||
} else {
|
||||
this.toastr.error(this.i18nService.syncingFailed);
|
||||
}
|
||||
});
|
||||
this.syncService.fullSync(true).then((success: boolean) => {
|
||||
this.loading = false;
|
||||
if (success) {
|
||||
this.setLastSync();
|
||||
this.$analytics.eventTrack('Synced Full');
|
||||
this.toastr.success(this.i18nService.syncingComplete);
|
||||
} else {
|
||||
this.toastr.error(this.i18nService.syncingFailed);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
setLastSync() {
|
||||
this.syncService
|
||||
.getLastSync()
|
||||
.then((lastSync: any) => {
|
||||
if (lastSync) {
|
||||
this.lastSync = lastSync.toLocaleDateString() + ' ' + lastSync.toLocaleTimeString();
|
||||
} else {
|
||||
this.lastSync = this.i18nService.never;
|
||||
}
|
||||
});
|
||||
this.syncService.getLastSync().then((lastSync: any) => {
|
||||
if (lastSync) {
|
||||
this.lastSync = lastSync.toLocaleDateString() + ' ' + lastSync.toLocaleTimeString();
|
||||
} else {
|
||||
this.lastSync = this.i18nService.never;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user