25 lines
538 B
TypeScript
25 lines
538 B
TypeScript
import { useQuery } from '@tanstack/react-query';
|
|||
|
|
import { getPaymentsMethods } from '@/app/actions/paymentAction';
|
||
|
|
|
||
|
|
/* export interface PaymentsMethods {
|
||
|
|
total_violations: number,
|
||
|
|
new_violations: number,
|
||
|
|
in_progress_violations: number,
|
||
|
|
resolved_violations: number
|
||
|
|
} */
|
||
|
|
|
||
|
|
export const usePaymentsMethods = () => {
|
||
|
|
return useQuery({
|
||
|
|
queryKey: ['paymentsMethods'],
|
||
|
|
queryFn: () => {
|
||
|
|
return getPaymentsMethods()
|
||
|
|
},
|
||
|
|
select: (data: any | null) => {
|
||
|
|
if (!data) {
|
||
|
|
return null
|
||
|
|
}
|
||
|
|
return data;
|
||
|
|
},
|
||
|
|
retry: false
|
||
|
|
});
|
||
|
|
};
|