new changes
This commit is contained in:
@@ -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;
|
||||
Reference in New Issue
Block a user