Wait for app list before setting ready flag
This commit is contained in:
+18
-8
@@ -288,22 +288,26 @@ angular.module('Application').controller('AppStoreController', ['$scope', '$loca
|
||||
getSubscription(function (error) {
|
||||
if (error) return console.error(error);
|
||||
|
||||
onSubscribed();
|
||||
onSubscribed(function (error) { if (error) console.error(error); });
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
function onSubscribed() {
|
||||
function onSubscribed(callback) {
|
||||
Client.getAppstoreApps(function (error) {
|
||||
if (error) return console.error(error);
|
||||
if (error) return callback(error);
|
||||
|
||||
// start with featured apps listing. this also sets $scope.apps accordingly
|
||||
$scope.showCategory(null, 'featured');
|
||||
|
||||
// do this in background
|
||||
fetchUsers();
|
||||
fetchGroups();
|
||||
|
||||
// domains is required since we populate the dropdown with domains[0]
|
||||
Client.getDomains(function (error, result) {
|
||||
if (error) console.error(error);
|
||||
if (error) return callback(error);
|
||||
|
||||
$scope.domains = result;
|
||||
|
||||
@@ -312,6 +316,8 @@ angular.module('Application').controller('AppStoreController', ['$scope', '$loca
|
||||
setTimeout(hashChangeListener, 1);
|
||||
|
||||
setTimeout(function () { $('#appstoreSearch').focus(); }, 1000);
|
||||
|
||||
callback();
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -476,12 +482,16 @@ angular.module('Application').controller('AppStoreController', ['$scope', '$loca
|
||||
return $timeout(init, 1000);
|
||||
}
|
||||
|
||||
fetchUsers();
|
||||
fetchGroups();
|
||||
if (!$scope.validSubscription) { // show the login form
|
||||
$scope.ready = true;
|
||||
return;
|
||||
}
|
||||
|
||||
if ($scope.validSubscription) onSubscribed();
|
||||
onSubscribed(function (error) {
|
||||
if (error) console.error(error);
|
||||
|
||||
$scope.ready = true;
|
||||
$scope.ready = true;
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user