Skip to content

Commit

Permalink
Remove hardcoded values
Browse files Browse the repository at this point in the history
-Replace hardcoded tier ID values on frontend with enum in frontend/types/
  • Loading branch information
haoyangw committed Nov 11, 2024
1 parent 6460224 commit 05949b1
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions frontend/app/(authenticated)/user/billing/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const getPriceButtonText = (
priceTierId: number,
user: UserPublic | undefined,
) => {
const userTierId = user?.tier_id || 1;
const userTierId = user?.tier_id || JippyTierID.Free;
const isUserUnverified =
user?.verified === false || userTierId === UNVERIFIED_TIER_ID;
if (isUserUnverified) {
Expand Down Expand Up @@ -84,7 +84,7 @@ const Page = () => {
onClickBuy: () => {
stripeCheckoutMutation.mutate({
price_id: process.env.NEXT_PUBLIC_STRIPE_PREMIUM_TIER_PRICE_ID || "",
tier_id: Number(process.env.NEXT_PUBLIC_PREMIUM_TIER_ID) || 1,
tier_id: Number(process.env.NEXT_PUBLIC_PREMIUM_TIER_ID) || JippyTierID.Free,
});
},
price: TierPrice.Premium,
Expand Down Expand Up @@ -116,7 +116,7 @@ const Page = () => {
// Display toast to notify the user that payment got cancelled
toast({
title: "Payment Cancelled",
description: `Unable to upgrade your tier, you remain at ${tierIDToTierName(user?.tier_id || 1)} Tier`,
description: `Unable to upgrade your tier, you remain at ${tierIDToTierName(user?.tier_id || JippyTierID.Free)} Tier`,
});

// Remove query parameters from the URL after showing the toast
Expand Down

0 comments on commit 05949b1

Please sign in to comment.