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) {
if (!Features.BILLING) { return; }
if (plans) {
if (plans && plans.length) {
callback(plans);
return;
}
ApiService.listPlans().then(function(data) {
var i = 0;
for(i = 0; i < data.plans.length; i++) {
planDict[data.plans[i].stripeId] = data.plans[i];
}
plans = data.plans;
if (plans) {
callback(plans);
plans = data.plans || [];
for(var i = 0; i < plans.length; i++) {
planDict[plans[i].stripeId] = plans[i];
}
callback(plans);
}, function() { callback([]); });
};