new changes

This commit is contained in:
Mamalizz
2025-03-09 20:39:27 +03:30
parent 869caaf53c
commit ac14cbd8ff
2 changed files with 30 additions and 30 deletions
@@ -0,0 +1,30 @@
// imports
import { useQuery } from "@tanstack/vue-query";
import { API_ENDPOINTS, QUERY_KEYS } from "~/constants";
// types
export type GetOrdersCartResponse = Order[];
const useGetOrdersCart = () => {
// state
const { $axios: axios } = useNuxtApp();
// methods
const handleGetOrdersCart = async () => {
const { data } = await axios.get<GetOrdersCartResponse>(
API_ENDPOINTS.orders.get_cart
);
return data;
};
return useQuery({
queryKey: [QUERY_KEYS.cart],
queryFn: () => handleGetOrdersCart(),
});
};
export default useGetOrdersCart;
@@ -1,30 +0,0 @@
// imports
import { useQuery } from "@tanstack/vue-query";
import { API_ENDPOINTS, QUERY_KEYS } from "~/constants";
// types
export type GetOrdersListResponse = Order[];
const useGetOrdersList = () => {
// state
const { $axios: axios } = useNuxtApp();
// methods
const handleGetOrdersList = async () => {
const { data } = await axios.get<GetOrdersListResponse>(
API_ENDPOINTS.orders.get_all
);
return data;
};
return useQuery({
queryKey: [QUERY_KEYS.tickets],
queryFn: () => handleGetOrdersList(),
});
};
export default useGetOrdersList;