Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | 2x 2x 1x 10x 1x | import { API } from "aws-amplify"; import { useQuery, UseQueryOptions } from "@tanstack/react-query"; import { ReactQueryApiError } from "shared-types"; import { cpocs } from "shared-types/opensearch"; export async function fetchCpocData() { try { const response = await API.post("os", "/getCpocs", { body: {} }); const results = response.hits?.hits || []; return results.map((hit: cpocs.ItemResult) => hit._source); } catch (error) { console.error("Error fetching CPOCs:", error); } } export function useGetCPOCs<T>(queryOptions?: UseQueryOptions<T[], ReactQueryApiError>) { return useQuery<T[], ReactQueryApiError>(["package-cpocs"], () => fetchCpocData(), queryOptions); } |