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

39 lines
751 B
TypeScript
Raw Normal View History

2026-02-24 17:22:01 +07:00
import { useQuery } from '@tanstack/react-query';
import {getUserPayments} from '@/app/actions/referralsActions';
export interface PaymentsData {
amount: number,
cancellationReason: string | null,
createdAt: string,
id: number,
operationType: string,
paymentUuid: string,
status: string,
updatedAt: string,
}
export interface UserPayments {
payments: PaymentsData[],
error: string | null
}
export const useGetReferralPayments = () => {
return useQuery({
queryKey: ['referralPayments'],
queryFn: getUserPayments,
select: (data): UserPayments => {
/* console.log('referralPayments');
console.log(data); */
if (!data) {
return {
payments: [],
error: null
}
}
return data;
},
retry: false
});
};