stripe frontend

This commit is contained in:
2026-01-28 18:33:30 +00:00
parent 6cf7e79f20
commit 98ff4014cc
10 changed files with 504 additions and 109 deletions

View File

@@ -0,0 +1,27 @@
import type { SubscriptionRecord } from "@sprint/shared";
import { getServerURL } from "@/lib/utils";
interface GetSubscriptionParams {
onSuccess?: (subscription: SubscriptionRecord | null) => void;
onError?: (error: string) => void;
}
export async function getSubscription({ onSuccess, onError }: GetSubscriptionParams) {
try {
const response = await fetch(`${getServerURL()}/subscription/get`, {
method: "GET",
credentials: "include",
});
const data = await response.json();
if (!response.ok) {
onError?.(data.error || "Failed to fetch subscription");
return;
}
onSuccess?.(data.subscription);
} catch (error) {
onError?.("Network error");
}
}