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

26 lines
538 B
TypeScript
Raw Normal View History

2026-04-02 17:59:47 +07:00
import { useQuery } from '@tanstack/react-query';
import { getPaymentsMethods } from '@/app/actions/paymentAction';
2026-04-03 14:52:31 +07:00
export interface PaymentsMethods {
cardType: string,
expiryMonth: string,
expiryYear: string,
lastFour: string,
paymentMethodId: string
}
2026-04-02 17:59:47 +07:00
export const usePaymentsMethods = () => {
return useQuery({
queryKey: ['paymentsMethods'],
queryFn: () => {
return getPaymentsMethods()
},
2026-04-03 14:52:31 +07:00
select: (data: PaymentsMethods[] | null) => {
2026-04-02 17:59:47 +07:00
if (!data) {
return null
}
return data;
},
retry: false
});
};