edit payments history
This commit is contained in:
@@ -1,20 +1,19 @@
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
import {getUserPayments} from '@/app/actions/referralsActions';
|
||||
import { getUserPayments } from '@/app/actions/referralsActions';
|
||||
|
||||
export interface PaymentsData {
|
||||
export interface ReferralPayments {
|
||||
amount: number,
|
||||
cancellationReason: string | null,
|
||||
completedAt: string | null,
|
||||
createdAt: string,
|
||||
id: number,
|
||||
operationType: string,
|
||||
paymentUuid: string,
|
||||
processAt: string | null
|
||||
rejectionReason: string | null,
|
||||
status: string,
|
||||
updatedAt: string,
|
||||
}
|
||||
|
||||
|
||||
export interface UserPayments {
|
||||
payments: PaymentsData[],
|
||||
export interface UserReferralPayments {
|
||||
payments: ReferralPayments[],
|
||||
error: string | null
|
||||
}
|
||||
|
||||
@@ -22,17 +21,18 @@ export const useGetReferralPayments = () => {
|
||||
return useQuery({
|
||||
queryKey: ['referralPayments'],
|
||||
queryFn: getUserPayments,
|
||||
select: (data): UserPayments => {
|
||||
/* console.log('referralPayments');
|
||||
console.log(data); */
|
||||
select: (data): UserReferralPayments => {
|
||||
if (!data) {
|
||||
return {
|
||||
payments: [],
|
||||
error: null
|
||||
error: 'error'
|
||||
}
|
||||
}
|
||||
|
||||
return data;
|
||||
return {
|
||||
payments: data.payments,
|
||||
error: data.error
|
||||
}
|
||||
},
|
||||
retry: false
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user