import { useQuery } from "@pinia/colada";
import { computed } from "vue";
import { u as useApi } from "./useApi-Dv-cyvzn.js";
import { d as useI18n, j as createError } from "../server.mjs";
function useCategorysQuery(page) {
  const { get } = useApi();
  const { locale } = useI18n();
  return useQuery({
    staleTime: 1e3 * 60 * 60,
    key: computed(() => ["projects", page, locale.value]),
    query: async () => {
      try {
        const response = await get(`projects`, {
          params: { page }
        });
        return response.data;
      } catch (error) {
        console.error(error.message);
      }
    }
  });
}
function useCategoryQuery(serviceId, page) {
  const { get } = useApi();
  const { locale } = useI18n();
  return useQuery({
    staleTime: 1e3 * 60 * 60,
    key: computed(() => ["projects", serviceId, page, locale.value]),
    query: async () => {
      try {
        const response = await get(`projects`, {
          params: {
            service_id: serviceId,
            page
          }
        });
        return response.data;
      } catch (error) {
        console.error(error.message);
      }
    }
  });
}
function useProjectDetailsQuery(slug) {
  const { get } = useApi();
  const { locale } = useI18n();
  return useQuery({
    staleTime: 1e3 * 60 * 60,
    key: computed(() => ["project", slug, locale.value]),
    query: async () => {
      var _a;
      try {
        const response = await get(`projects/${slug}`);
        return response.data.data;
      } catch (error) {
        throw createError({
          statusCode: ((_a = error == null ? void 0 : error.response) == null ? void 0 : _a.status) || 404,
          statusMessage: "Project Not Found"
        });
      }
    }
  });
}
export {
  useCategoryQuery as a,
  useProjectDetailsQuery as b,
  useCategorysQuery as u
};
//# sourceMappingURL=projects-xPpvD22W.js.map
