mirror of
https://github.com/jjbrunton/Sauci.git
synced 2026-10-31 18:19:43 +00:00
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.
17 lines
594 B
TypeScript
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>
|
|
}
|
|
|