import { useQuery } from "@pinia/colada";
import { useApi } from "~/composables/useApi";
import type { AxiosResponse } from "axios";

export function useWebsiteNumbresQuery() {
  const { get } = useApi();

  return useQuery({
    staleTime: 1000 * 60 * 60,
    key: ["websiteNumbres"],
    query: async () => {
      try {
        const response = (await get("website_numbers")) as AxiosResponse;
        return response.data.data;
      } catch (error: any) {
        console.error(error.message);
      }
    },
  });
}
