Skip to content

Commit a37818a

Browse files
committed
fix usages null state
1 parent 2d776b0 commit a37818a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

packages/dashboard/src/app/(layout)/subscription/components/SubscriptionCard.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export default function SubscriptionCard({subscription, usages, customerData}: P
2323
const isPro = subscription?.subscription_status === "active";
2424
const maxRequestsPerMonth = isPro ? PLANS.PRO.REQUESTS_PER_MONTH : PLANS.BASIC.REQUESTS_PER_MONTH
2525

26-
const usagePercentage = Math.min((usages / maxRequestsPerMonth) * 100, 100)
26+
const usagePercentage = Math.min(((usages || 0) / maxRequestsPerMonth) * 100, 100)
2727

2828
// Handle cancel
2929
const handleCancel = async () => {
@@ -70,7 +70,7 @@ export default function SubscriptionCard({subscription, usages, customerData}: P
7070
<div className="mb-2 flex justify-between items-center">
7171
<div className="text-sm text-gray-500">API Requests</div>
7272
<div className="text-sm font-medium">
73-
{usages} / {maxRequestsPerMonth}
73+
{usages || 0} / {maxRequestsPerMonth}
7474
</div>
7575
</div>
7676
<Progress value={usagePercentage} className="h-2"/>

0 commit comments

Comments
 (0)