change name hook

This commit is contained in:
hamid zarghami
2025-12-07 16:43:23 +03:30
parent 10e5143d78
commit 0bc80a59ec
4 changed files with 13 additions and 3 deletions
+24
View File
@@ -0,0 +1,24 @@
import { useMutation, useQuery } from "@tanstack/react-query";
import * as api from "../service/OrderService";
import type { GetOrdersParams } from "../service/OrderService";
export const useGetOrders = (params?: GetOrdersParams) => {
return useQuery({
queryKey: ["orders", params],
queryFn: () => api.getOrders(params),
});
};
export const useGetOrderById = (orderId: string) => {
return useQuery({
queryKey: ["order", orderId],
queryFn: () => api.getOrderById(orderId),
enabled: !!orderId,
});
};
export const useConfirmOrder = (orderId: string) => {
return useMutation({
mutationFn: () => api.confirmOrder(orderId),
});
};