38 lines
888 B
TypeScript
38 lines
888 B
TypeScript
import { useMutation, useQuery } from "@tanstack/react-query";
|
|
import * as api from "../service/WalletService";
|
|
import { DepositTransferType, PaymentType } from "../types/WalletTypes";
|
|
|
|
export const useGetGetWays = () => {
|
|
return useQuery({
|
|
queryKey: ["getGetWays"],
|
|
queryFn: api.getGetWays,
|
|
});
|
|
};
|
|
|
|
export const useGetWalletBalance = () => {
|
|
return useQuery({
|
|
queryKey: ["wallet-balance"],
|
|
queryFn: api.getWalletBalance,
|
|
});
|
|
};
|
|
|
|
export const usePayment = () => {
|
|
return useMutation({
|
|
mutationFn: (variables: PaymentType) => api.payment(variables),
|
|
});
|
|
};
|
|
|
|
export const useGetBankAccount = () => {
|
|
return useQuery({
|
|
queryKey: ["bankAccount"],
|
|
queryFn: api.getBankAccount,
|
|
});
|
|
};
|
|
|
|
export const useDepositTransfer = () => {
|
|
return useMutation({
|
|
mutationFn: (variables: DepositTransferType) =>
|
|
api.depositTransfer(variables),
|
|
});
|
|
};
|