From ac14cbd8ffd711f19cac382995dc044601e991b0 Mon Sep 17 00:00:00 2001 From: Mamalizz Date: Sun, 9 Mar 2025 20:39:27 +0330 Subject: [PATCH] new changes --- .../api/orders/useGetOrdersCart.ts | 30 +++++++++++++++++++ .../api/orders/useGetOrdersList.ts | 30 ------------------- 2 files changed, 30 insertions(+), 30 deletions(-) create mode 100644 frontend/composables/api/orders/useGetOrdersCart.ts delete mode 100644 frontend/composables/api/orders/useGetOrdersList.ts diff --git a/frontend/composables/api/orders/useGetOrdersCart.ts b/frontend/composables/api/orders/useGetOrdersCart.ts new file mode 100644 index 0000000..30589ba --- /dev/null +++ b/frontend/composables/api/orders/useGetOrdersCart.ts @@ -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( + API_ENDPOINTS.orders.get_cart + ); + return data; + }; + + return useQuery({ + queryKey: [QUERY_KEYS.cart], + queryFn: () => handleGetOrdersCart(), + }); +}; + +export default useGetOrdersCart; diff --git a/frontend/composables/api/orders/useGetOrdersList.ts b/frontend/composables/api/orders/useGetOrdersList.ts deleted file mode 100644 index f63798c..0000000 --- a/frontend/composables/api/orders/useGetOrdersList.ts +++ /dev/null @@ -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( - API_ENDPOINTS.orders.get_all - ); - return data; - }; - - return useQuery({ - queryKey: [QUERY_KEYS.tickets], - queryFn: () => handleGetOrdersList(), - }); -}; - -export default useGetOrdersList;