1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-18 17:23:37 +00:00

cleanup and formatting

This commit is contained in:
Kyle Spearrin
2017-11-27 23:46:03 -05:00
parent 78c4ea7ecb
commit 8332e52a7b
19 changed files with 104 additions and 146 deletions

View File

@@ -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;
}
});
}
}