This commit is contained in:
hamid zarghami
2025-02-08 14:20:50 +03:30
parent 1e8b542960
commit 19636230ba
19 changed files with 612 additions and 127 deletions
+30
View File
@@ -0,0 +1,30 @@
import { useMutation, useQuery } from "@tanstack/react-query";
import * as api from "../service/PaymentService";
import { PaymentStatusType, RejectPaymentType } from "../types/PaymentTypes";
export const useGetPayments = (page: number, type: PaymentStatusType) => {
return useQuery({
queryKey: ["payments", page, type],
queryFn: () => api.getPayments(page, type),
enabled: type !== "GATEWAY",
});
};
export const useApproveTransfer = () => {
return useMutation({
mutationFn: (variables: string) => api.approveTransfer(variables),
});
};
export const useRejectTransfer = () => {
return useMutation({
mutationFn: (variables: RejectPaymentType) => api.rejectTransfer(variables),
});
};
export const useGetGateWayPayment = (page: number) => {
return useQuery({
queryKey: ["gateway-payments", page],
queryFn: () => api.getPaymentGateways(page),
});
};