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
21 lines
604 B
TypeScript
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,
|
|
});
|
|
}
|