Handle the case where the plans do not load correctly.

This commit is contained in:
Joseph Schorr 2014-06-04 16:27:45 -04:00
parent 738c4a86ff
commit bbb48b1235

View file

@ -1093,20 +1093,17 @@ quayApp = angular.module('quay', quayDependencies, function($provide, cfpLoading
planService.verifyLoaded = function(callback) { planService.verifyLoaded = function(callback) {
if (!Features.BILLING) { return; } if (!Features.BILLING) { return; }
if (plans) { if (plans && plans.length) {
callback(plans); callback(plans);
return; return;
} }
ApiService.listPlans().then(function(data) { ApiService.listPlans().then(function(data) {
var i = 0; plans = data.plans || [];
for(i = 0; i < data.plans.length; i++) { for(var i = 0; i < plans.length; i++) {
planDict[data.plans[i].stripeId] = data.plans[i]; planDict[plans[i].stripeId] = plans[i];
}
plans = data.plans;
if (plans) {
callback(plans);
} }
callback(plans);
}, function() { callback([]); }); }, function() { callback([]); });
}; };