diff options
| author | Dax Raad <[email protected]> | 2026-01-14 11:25:48 -0500 |
|---|---|---|
| committer | Dax Raad <[email protected]> | 2026-01-14 11:25:50 -0500 |
| commit | 44d24d42b8519e1c55b4a770ca640629c0bf2965 (patch) | |
| tree | 7547311332f1b40b39ed5d5c65bfe451ad559b04 | |
| parent | 3a9e6b558c883cde60398b05e7aab5242478a7b6 (diff) | |
| download | opencode-44d24d42b8519e1c55b4a770ca640629c0bf2965.tar.gz opencode-44d24d42b8519e1c55b4a770ca640629c0bf2965.zip | |
ignore: fix auth redirect to preserve selected plan during subscription flow
| -rw-r--r-- | packages/console/app/src/routes/black/subscribe/[plan].tsx | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/packages/console/app/src/routes/black/subscribe/[plan].tsx b/packages/console/app/src/routes/black/subscribe/[plan].tsx index 5e13799dd..b2b9b32e1 100644 --- a/packages/console/app/src/routes/black/subscribe/[plan].tsx +++ b/packages/console/app/src/routes/black/subscribe/[plan].tsx @@ -18,10 +18,10 @@ import { Billing } from "@opencode-ai/console-core/billing.js" const plansMap = Object.fromEntries(plans.map((p) => [p.id, p])) as Record<PlanID, (typeof plans)[number]> const stripePromise = loadStripe(import.meta.env.VITE_STRIPE_PUBLISHABLE_KEY!) -const getWorkspaces = query(async () => { +const getWorkspaces = query(async (plan: string) => { "use server" const actor = await getActor() - if (actor.type === "public") throw redirect("/auth/authorize?continue=/black/subscribe") + if (actor.type === "public") throw redirect("/auth/authorize?continue=/black/subscribe/" + plan) return withActor(async () => { return Database.use((tx) => tx @@ -258,15 +258,16 @@ function IntentForm(props: { plan: PlanID; workspaceID: string; onSuccess: (data } export default function BlackSubscribe() { - const workspaces = createAsync(() => getWorkspaces()) + const params = useParams() + const planData = plansMap[(params.plan as PlanID) ?? "20"] ?? plansMap["20"] + const plan = planData.id + + const workspaces = createAsync(() => getWorkspaces(plan)) const [selectedWorkspace, setSelectedWorkspace] = createSignal<string | undefined>(undefined) const [success, setSuccess] = createSignal<SuccessData | undefined>(undefined) const [failure, setFailure] = createSignal<string | undefined>(undefined) const [clientSecret, setClientSecret] = createSignal<string | undefined>(undefined) const [stripe, setStripe] = createSignal<Stripe | undefined>(undefined) - const params = useParams() - const planData = plansMap[(params.plan as PlanID) ?? "20"] ?? plansMap["20"] - const plan = planData.id // Resolve stripe promise once createEffect(() => { |
