TorbatYar/frontend/modules/payment/hooks/usePaymentCapabilities.ts
Mortezakoohjani 4451b32a33 feat(payment-frontend): ship Torbat Pay admin portal for MVP 14.0-14.5
Add payment module, BFF proxy, hub/dashboard/ops/PSP/merchant screens wired to real APIs, and mark payment-frontend complete in project status.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-27 18:35:07 +03:30

32 lines
863 B
TypeScript

"use client";
import { useQuery } from "@tanstack/react-query";
import { useTenantId } from "@/hooks/useTenantId";
import { paymentApi } from "@/modules/payment/services/payment-api";
export function usePaymentCapabilities() {
const { tenantId } = useTenantId();
return useQuery({
queryKey: ["payment", tenantId, "capabilities"],
queryFn: () => paymentApi.capabilities(tenantId!),
enabled: !!tenantId,
staleTime: 60_000,
});
}
export function usePaymentHealth() {
return useQuery({
queryKey: ["payment", "health"],
queryFn: () => paymentApi.health(),
});
}
export function usePaymentMetrics() {
const { tenantId } = useTenantId();
return useQuery({
queryKey: ["payment", tenantId, "metrics"],
queryFn: () => paymentApi.metrics(tenantId ?? undefined),
staleTime: 30_000,
});
}