mirror of
https://github.com/openswarm-ai/openswarm.git
synced 2026-09-28 12:34:50 +02:00
[eric] fix dead annual subscribe buttons: desktop was sending billing_interval="annual" but cloud zod enum only accepted
"monthly"|"yearly" so the POST returned 400 and the click silently no-opped — now map annual→yearly at the fetch boundary, UI/types/analytics stay on "annual"
This commit is contained in:
@@ -26,10 +26,13 @@ export async function subscribeToPlan(
|
||||
});
|
||||
|
||||
try {
|
||||
// Cloud schema uses "yearly"; the desktop UI/analytics uses "annual".
|
||||
// Normalize at the boundary so the rest of the client stays consistent.
|
||||
const wireInterval = billingInterval === 'annual' ? 'yearly' : billingInterval;
|
||||
const r = await fetch('https://api.openswarm.com/api/stripe/checkout', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ plan, billing_interval: billingInterval }),
|
||||
body: JSON.stringify({ plan, billing_interval: wireInterval }),
|
||||
});
|
||||
if (!r.ok) {
|
||||
console.error(`Checkout request failed: ${r.status}`);
|
||||
|
||||
Reference in New Issue
Block a user