gendesign/tradein-mvp/frontend/src/lib/useQuota.ts
lekss361 bd3e5c8216
All checks were successful
Deploy / changes (push) Successful in 5s
Deploy Trade-In / changes (push) Successful in 7s
Deploy / build-backend (push) Successful in 29s
Deploy / build-frontend (push) Successful in 28s
Deploy / build-worker (push) Successful in 29s
Deploy Trade-In / build-backend (push) Successful in 46s
Deploy / deploy (push) Successful in 58s
Deploy Trade-In / build-frontend (push) Successful in 1m40s
Deploy Trade-In / deploy (push) Successful in 39s
feat(tradein): аккаунт praktika + лимит 15 оценок/мес, чистка PRINZIP в UI (#635)
2026-05-28 22:04:58 +00:00

21 lines
604 B
TypeScript

"use client";
import { useQuery } from "@tanstack/react-query";
import { apiFetch } from "@/lib/api";
import type { QuotaStatus } from "@/types/trade-in";
const BASE = "/api/v1/trade-in";
/**
* GET /api/v1/trade-in/quota
* Fetches the monthly evaluation quota status for the current session/account.
* Fail-open: if the query errors, the UI must NOT block the user (treat as unlimited).
*/
export function useQuota() {
return useQuery<QuotaStatus>({
queryKey: ["trade-in", "quota"],
queryFn: () => apiFetch<QuotaStatus>(`${BASE}/quota`),
staleTime: 30_000,
retry: false,
});
}