so i only get one user plan
так я получаю только один план пользователя
user.getPricingPlans()
.then( (pricingPlans) => {
let firstPlan = pricingPlans[0];
$w('#text28').text = firstPlan.name;
} );
How can I get a list of all purchased plans?
а как мне получить список всех купленных планов ?
Thank you! I forgot about it)
Спасибо! я забыл об этом )
$w('#allPlan').text = '';
user.getPricingPlans()
.then( (pricingPlans) => {
for(let i=0; i< pricingPlans.length;i++){
if (i>0) $w('#allPlan').text = $w('#allPlan').text + ',';
$w('#allPlan').text = $w('#allPlan').text +" "+ pricingPlans[i].name;
}
} );
Hi there,
The promise returns all the purchased plans, so it’s a matter of how to display them, here’s a simple example of how to log all items to the console.
const plans = await user.getPricingPlans();
plans.forEach(plan => console.log(plan));
I strongly recommend what Ivan said, learn more about arrays until you feel comfortable dealing with them, there are a lot of arrays’ methods out there, so check them out.