This commit is contained in:
Mo Bitar
2017-01-27 13:54:23 -06:00
parent 3029a97c0e
commit 7c88531cff
9 changed files with 53 additions and 55 deletions

View File

@@ -13,9 +13,11 @@ angular.module('app.frontend')
scope.$on("sync:updated_token", function(){
ctrl.syncUpdated();
ctrl.findErrors();
ctrl.updateOfflineStatus();
})
scope.$on("sync:error", function(){
ctrl.findErrors();
ctrl.updateOfflineStatus();
})
}
}
@@ -23,7 +25,11 @@ angular.module('app.frontend')
.controller('HeaderCtrl', function (apiController, modelManager, $timeout, dbManager, syncManager) {
this.user = apiController.user;
this.offline = syncManager.offline;
this.updateOfflineStatus = function() {
this.offline = syncManager.offline;
}
this.updateOfflineStatus();
this.findErrors = function() {
this.error = syncManager.syncProviders.filter(function(provider){return provider.error}).length > 0 ? true : false;