import { useQuery } from "@tanstack/react-query";
import { geocodeKeys } from "~/features/geocodes";
const HERE_ENDPOINT = "https://geocoder.ls.hereapi.com/6.2/geocode.json?";
export function useGeocodes(locationid) {
    const options = {
        locationid,
        country: "CAN,USA",
        apiKey: import.meta.env.VITE_HERE_API_KEY,
    };
    const fetchGeocodes = () => fetch(HERE_ENDPOINT + new URLSearchParams(options))
        .then((response) => response.json())
        .then((response) => response.Response.View[0].Result[0]);
    return useQuery({
        queryKey: geocodeKeys.list(options),
        queryFn: fetchGeocodes,
        enabled: !!locationid,
    });
}
//# sourceMappingURL=useLegacyGeocodes.js.map