Files
no-copy-frontend/src/app/hooks/react-query/usePaymentsMethods.ts
T

26 lines
538 B
TypeScript

import { useQuery } from '@tanstack/react-query';
import { getPaymentsMethods } from '@/app/actions/paymentAction';
export interface PaymentsMethods {
cardType: string,
expiryMonth: string,
expiryYear: string,
lastFour: string,
paymentMethodId: string
}
export const usePaymentsMethods = () => {
return useQuery({
queryKey: ['paymentsMethods'],
queryFn: () => {
return getPaymentsMethods()
},
select: (data: PaymentsMethods[] | null) => {
if (!data) {
return null
}
return data;
},
retry: false
});
};