currentSubscription is not required anymore
This commit is contained in:
@@ -7,7 +7,6 @@ angular.module('Application').controller('MainController', ['$scope', '$route',
|
||||
$scope.config = {};
|
||||
$scope.status = {};
|
||||
$scope.client = Client;
|
||||
$scope.currentSubscription = null;
|
||||
$scope.appstoreConfig = {};
|
||||
|
||||
$scope.hideNavBarActions = $location.path() === '/logs';
|
||||
@@ -56,8 +55,6 @@ angular.module('Application').controller('MainController', ['$scope', '$route',
|
||||
AppStore.getSubscription($scope.appstoreConfig, function (error, result) {
|
||||
if (error) return console.error(error);
|
||||
|
||||
$scope.currentSubscription = result;
|
||||
|
||||
// check again to give more immediate feedback once a subscription was setup
|
||||
if (result.plan.id === 'undecided' || result.plan.id === 'free') {
|
||||
$timeout(checkPlan, 5000);
|
||||
@@ -88,8 +85,6 @@ angular.module('Application').controller('MainController', ['$scope', '$route',
|
||||
$('#setupSubscriptionModal').modal('show');
|
||||
} else if ($scope.config.provider === 'caas') {
|
||||
$('#updateModal').modal('show');
|
||||
} else if (!$scope.currentSubscription || !$scope.currentSubscription.plan) {
|
||||
// do nothing as we were not able to get a subscription, yet
|
||||
} else {
|
||||
$('#updateModal').modal('show');
|
||||
}
|
||||
@@ -157,28 +152,6 @@ angular.module('Application').controller('MainController', ['$scope', '$route',
|
||||
});
|
||||
}
|
||||
|
||||
$scope.getSubscription = function () {
|
||||
Client.getAppstoreConfig(function (error, result) {
|
||||
if (error) return console.error(error);
|
||||
|
||||
if (result.token) {
|
||||
$scope.appstoreConfig = result;
|
||||
|
||||
AppStore.getProfile(result.token, function (error, result) {
|
||||
if (error) return console.error(error);
|
||||
|
||||
$scope.appstoreConfig.profile = result;
|
||||
|
||||
AppStore.getSubscription($scope.appstoreConfig, function (error, result) {
|
||||
if (error) return console.error(error);
|
||||
|
||||
$scope.currentSubscription = result;
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Client.getStatus(function (error, status) {
|
||||
if (error) return $scope.error(error);
|
||||
|
||||
@@ -215,7 +188,6 @@ angular.module('Application').controller('MainController', ['$scope', '$route',
|
||||
window.location.reload(true);
|
||||
}
|
||||
|
||||
|
||||
Client.refreshUserInfo(function (error) {
|
||||
if (error) return $scope.error(error);
|
||||
|
||||
@@ -232,7 +204,18 @@ angular.module('Application').controller('MainController', ['$scope', '$route',
|
||||
if ($scope.user.admin) {
|
||||
runConfigurationChecks();
|
||||
|
||||
if ($scope.config.provider !== 'caas') $scope.getSubscription();
|
||||
Client.getAppstoreConfig(function (error, result) {
|
||||
if (error) return console.error(error);
|
||||
if (!result.token) return;
|
||||
|
||||
$scope.appstoreConfig = result;
|
||||
|
||||
AppStore.getProfile(result.token, function (error, result) {
|
||||
if (error) return console.error(error);
|
||||
|
||||
$scope.appstoreConfig.profile = result;
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user