better-auth/apps/web/modules/saas/payments/lib/server.ts
 Илья Шалонин 8538ab969a first
2025-10-29 13:43:43 +05:00

17 lines
410 B
TypeScript

import { getServerApiClient } from "@shared/lib/server";
import { cache } from "react";
export const getPurchases = cache(async (organizationId?: string) => {
const apiClient = await getServerApiClient();
const response = await apiClient.payments.purchases.$get({
query: {
organizationId,
},
});
if (!response.ok) {
throw new Error("Failed to fetch purchases");
}
return response.json();
});