Skip to content

Commit

Permalink
[dashboard] Show an error message when upgrading with Stripe fails
Browse files Browse the repository at this point in the history
  • Loading branch information
jankeromnes committed Sep 12, 2022
1 parent fcb426e commit 9cc8ac7
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions components/dashboard/src/teams/TeamUsageBasedBilling.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export default function TeamUsageBasedBilling() {
const [pollStripeSubscriptionTimeout, setPollStripeSubscriptionTimeout] = useState<NodeJS.Timeout | undefined>();
const [stripePortalUrl, setStripePortalUrl] = useState<string | undefined>();
const [usageLimit, setUsageLimit] = useState<number | undefined>();
const [upgradeError, setUpgradeError] = useState<Error | undefined>();

useEffect(() => {
if (!team) {
Expand Down Expand Up @@ -85,6 +86,7 @@ export default function TeamUsageBasedBilling() {
window.localStorage.removeItem(`pendingStripeSubscriptionForTeam${team.id}`);
clearTimeout(pollStripeSubscriptionTimeout!);
setPendingStripeSubscription(undefined);
setUpgradeError(error);
}
})();
}, [location.search, team]);
Expand Down Expand Up @@ -161,6 +163,7 @@ export default function TeamUsageBasedBilling() {
return (
<>
<h3>Usage-Based Billing</h3>
<p>{upgradeError && String(upgradeError)}</p>
<UsageBasedBillingConfig
userOrTeamId={team?.id || ""}
showSpinner={showSpinner}
Expand Down

0 comments on commit 9cc8ac7

Please sign in to comment.