// imports import { useQuery } from "@tanstack/vue-query"; import { API_ENDPOINTS, QUERY_KEYS } from "~/constants"; // types export type GetOrdersAllResponse = Order[]; const useGetOrdersAll = () => { // state const { $axios: axios } = useNuxtApp(); // methods const handleGetOrdersAll = async () => { const { data } = await axios.get( API_ENDPOINTS.orders.get_all ); return data; }; return useQuery({ queryKey: [QUERY_KEYS.orders], queryFn: () => handleGetOrdersAll(), }); }; export default useGetOrdersAll;