change name hook
This commit is contained in:
@@ -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),
|
||||
});
|
||||
};
|
||||
Reference in New Issue
Block a user