Files
Sauci/apps/web/app/redeem/redemptionApi.ts
T
jjbrunton 006761d3b0 feat(backend): add standalone data plane
Replace the Supabase application data plane with the Node/PostgreSQL API, migrate mobile, admin, web, and MCP callers, add controlled cutover tooling, and define hardened Dokploy infrastructure.
2026-08-28 14:42:11 +01:00

17 lines
594 B
TypeScript

export type RedemptionResponse =
| { success: true; message: string }
| { success: false; error: string }
export async function redeemCode(email: string, code: string): Promise<RedemptionResponse> {
const apiUrl = process.env.NEXT_PUBLIC_API_URL?.replace(/\/$/, '')
if (!apiUrl) throw new Error('NEXT_PUBLIC_API_URL is not configured')
const response = await fetch(`${apiUrl}/public/v1/redemptions`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ email, code }),
})
return response.json() as Promise<RedemptionResponse>
}