// imports import { useQuery } from "@tanstack/vue-query"; import { API_ENDPOINTS, QUERY_KEYS } from "~/constants"; import type { GetArticleResponse } from "~/composables/api/blog/useGetArticle"; // types export type GetHomeDataResponse = { "sliders": { "id": number, "link": string, "title": string, "description": string, "image": string | null, "video": string | null }[], "sub_categories": SubCategory[], "products": ProductListItem[], "difreance_section": { "image1": string, "image2": string, "title1": string, "title2": string, "description1": string, "description2": string, "link1": string, "link2": string }, "show_case_slider" : { "id": number, "title": string, "description": string, "link": string, "image": string, }[] }; const useHomeData = () => { // state const { $axios: axios } = useNuxtApp(); // methods const handleHomeData = async () => { const { data } = await axios.get(`${API_ENDPOINTS.home}`); return data; }; return useQuery({ queryKey: [QUERY_KEYS.home], queryFn: () => handleHomeData() }); }; export default useHomeData;