diff --git a/src/views/settings.html b/src/views/settings.html index 3be49bfae..45327271d 100644 --- a/src/views/settings.html +++ b/src/views/settings.html @@ -165,7 +165,7 @@ Account Email
- {{ appstoreConfig.profile.email }} + {{ subscription.email }}
@@ -173,7 +173,7 @@ Cloudron ID
- {{ appstoreConfig.cloudronId }} + {{ subscription.cloudronId }}
@@ -192,9 +192,9 @@
diff --git a/src/views/settings.js b/src/views/settings.js index 2e9c9b007..19747e578 100644 --- a/src/views/settings.js +++ b/src/views/settings.js @@ -9,7 +9,6 @@ angular.module('Application').controller('SettingsController', ['$scope', '$loca $scope.client = Client; $scope.user = Client.getUserInfo(); $scope.config = Client.getConfig(); - $scope.appstoreConfig = {}; $scope.installedApps = Client.getInstalledApps(); $scope.subscription = null; @@ -308,14 +307,14 @@ angular.module('Application').controller('SettingsController', ['$scope', '$loca } function getSubscription() { - AppStore.getSubscription($scope.appstoreConfig, function (error, result) { + Client.getSubscription(function (error, result) { if (error) return console.error(error); if (!$scope.$parent) return; // user changed view. otherwise we get an error that $scope.$parent is null $scope.subscription = result; // also reload the subscription on the main controller - $scope.$parent.fetchAppstoreProfileAndSubscription(function () {}); + $scope.$parent.updateSubscriptionStatus(function () {}); // check again to give more immediate feedback once a subscription was setup if (result.plan.id === 'free') $timeout(getSubscription, 10000); @@ -418,20 +417,7 @@ angular.module('Application').controller('SettingsController', ['$scope', '$loca $scope.update.checkStatus(); if (!$scope.config.managed) { - Client.getAppstoreConfig(function (error, appstoreConfig) { - if (error) return console.error(error); - if (!appstoreConfig.token) return; - - AppStore.getProfile(appstoreConfig.token, function (error, result) { - if (error) return console.error(error); - - // assign late to avoid UI flicketing on update - appstoreConfig.profile = result; - $scope.appstoreConfig = appstoreConfig; - - getSubscription(); - }); - }); + getSubscription(); } });