Skip to content

Commit

Permalink
fix: check price type
Browse files Browse the repository at this point in the history
  • Loading branch information
xn1cklas committed Sep 8, 2024
1 parent 9e8bb85 commit 5bdaa85
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/components/Products.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,11 @@ function mapProductsToPricingData(products: ProductOutput[]): PricingData[] {
return products
.filter((product) => product.name !== "Free") // this is a polyfill to ignore the free plan, until you can remove it from products
.map((product) => {
const monthlyPrice = product.prices.find(
//@ts-expect-error there seems to be a type issue for recurringInterval
(p) => p.recurringInterval === "month"
) as ProductPriceOutput;
const monthlyPrice = product.prices.find((p) => {
return p.type === "recurring" && p.recurringInterval === "month";
}) as ProductPriceOutput;
const annualPrice = product.prices.find(
//@ts-expect-error there seems to be a type issue for recurringInterval
(p) => p.recurringInterval === "year"
(p) => p.type === "recurring" && p.recurringInterval === "year"
) as ProductPriceOutput;
return {
id: product.id,
Expand Down

0 comments on commit 5bdaa85

Please sign in to comment.