Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

planPeriod searchParam

Steven Tey5bbd5865ed99
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/settings/billing/upgrade/page.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/settings/billing/upgrade/page.tsx
index e5a4c86f62..a92b03a830 100644
--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/settings/billing/upgrade/page.tsx
+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/settings/billing/upgrade/page.tsx
@@ -53,6 +53,7 @@ const COMPARE_FEATURE_ICONS: Record<
};
export default function WorkspaceBillingUpgradePage() {
+ const searchParams = useSearchParams();
const {
slug,
role,
@@ -70,14 +71,19 @@ export default function WorkspaceBillingUpgradePage() {
});
const [mobilePlanIndex, setMobilePlanIndex] = useState(0);
+
+ const planPeriod = searchParams.get("planPeriod") ?? "";
const [period, setPeriod] = useState<"monthly" | "yearly">(
- currentPlanPeriod === "yearly" ? "yearly" : "monthly",
+ ["monthly", "yearly"].includes(planPeriod)
+ ? (planPeriod as "monthly" | "yearly")
+ : currentPlanPeriod === "yearly"
+ ? "yearly"
+ : "monthly",
);
const { partnersUpgradeModal, setShowPartnersUpgradeModal } =
usePartnersUpgradeModal();
- const searchParams = useSearchParams();
useEffect(() => {
if (searchParams.get("showPartnersUpgradeModal")) {
setShowPartnersUpgradeModal(true);