Skip to content

Commit

Permalink
clients: simplify recurring prods
Browse files Browse the repository at this point in the history
  • Loading branch information
emilwidlund committed Feb 4, 2025
1 parent a5c0011 commit ff4f048
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,10 @@ const ChangePlanModal = ({
onUserSubscriptionUpdate: (subscription: CustomerSubscription) => void
}) => {
const router = useRouter()
const { data: allProducts } = useProducts(organization.id, { limit: 100 })
const products = allProducts?.items.filter(({ is_recurring }) => is_recurring)
const { data: products } = useProducts(organization.id, {
limit: 100,
isRecurring: true,
})

const currentPrice = subscription.price as
| ProductPriceRecurringFixed
Expand Down Expand Up @@ -226,7 +228,7 @@ const ChangePlanModal = ({
</List>
<h3 className="font-medium">Available Plans</h3>
<List size="small">
{products?.map((product) => (
{products?.items.map((product) => (
<>
{product.prices
.filter((price) => price.id !== subscription.price_id)
Expand Down

0 comments on commit ff4f048

Please sign in to comment.