Updated subscriptions

This commit is contained in:
KS Jannette
2026-05-12 17:39:42 -04:00
parent 2ab6dd0d6a
commit f086ef98ff
13 changed files with 386 additions and 78 deletions

View File

@@ -39,6 +39,7 @@ export default function Subscribe() {
password: "",
confirmPassword: "",
selectedTier: null,
billingInterval: "annual",
});
const [error, setError] = useState(
searchParams.get("payment") === "cancelled"
@@ -126,7 +127,7 @@ export default function Subscribe() {
await refreshAccount();
navigate("/addresses", { replace: true });
} else {
const { url } = await createCheckoutSession(data.selectedTier);
const { url } = await createCheckoutSession(data.selectedTier, data.billingInterval);
window.location.href = url;
}
} catch (err) {
@@ -245,7 +246,10 @@ export default function Subscribe() {
Select the plan that works best for you. You can upgrade anytime.
</p>
<TierPicker
onSelect={(tier) => set("selectedTier", tier)}
onSelect={(tier, interval) => {
set("selectedTier", tier);
set("billingInterval", interval);
}}
selectedTier={data.selectedTier}
/>
</>