mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-03-11 02:12:21 -05:00
Handled empty prices for product in Portal settings
no refs Monthly/yearly price values on a product can be `null` when stripe is not connected, this change handles the prices passed to Portal settings to ignore null prices in the array.
This commit is contained in:
parent
ba9b2ee68f
commit
d2e4f30b5b
1 changed files with 8 additions and 2 deletions
|
@ -84,12 +84,18 @@ const getPortalProductPrices = async function () {
|
|||
|
||||
const products = page.data.map((productModel) => {
|
||||
const product = productModel.toJSON();
|
||||
|
||||
const productPrices = [];
|
||||
if (product.monthlyPrice) {
|
||||
productPrices.push(product.monthlyPrice);
|
||||
}
|
||||
if (product.yearlyPrice) {
|
||||
productPrices.push(product.yearlyPrice);
|
||||
}
|
||||
return {
|
||||
id: product.id,
|
||||
name: product.name,
|
||||
description: product.description || '',
|
||||
prices: [product.monthlyPrice, product.yearlyPrice]
|
||||
prices: productPrices
|
||||
};
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue