gendesign/frontend/src/hooks/useConnectionPoints.ts
lekss361 e450546178
All checks were successful
Deploy / changes (push) Successful in 5s
Deploy / build-frontend (push) Successful in 1m58s
Deploy / deploy (push) Successful in 29s
Deploy / build-backend (push) Has been skipped
Deploy / build-worker (push) Has been skipped
feat(site-finder): NSPD frontend integration в LandTab (#202) (#212)
2026-05-16 11:55:31 +00:00

23 lines
615 B
TypeScript

"use client";
import { useQuery } from "@tanstack/react-query";
import { apiFetch } from "@/lib/api";
import type { ConnectionPointsResponse } from "@/types/nspd";
export type { ConnectionPointsResponse };
export function useConnectionPoints(
cadNum: string | null | undefined,
enabled = true,
) {
return useQuery<ConnectionPointsResponse>({
queryKey: ["connection-points", cadNum],
queryFn: () =>
apiFetch<ConnectionPointsResponse>(
`/api/v1/parcels/${encodeURIComponent(cadNum!)}/connection-points`,
),
enabled: !!cadNum && enabled,
staleTime: 5 * 60 * 1000,
});
}