update general statistic and analytic
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
import { fetchViolationAnalyticStatistic } from '@/app/actions/violationActions';
|
||||
|
||||
export interface UseViolationStatistic {
|
||||
[key: string]: number
|
||||
}
|
||||
|
||||
export const useViolationAnalyticStatistic = (group: 'domain' | 'tld') => {
|
||||
return useQuery({
|
||||
queryKey: ['violationAnalyticStatistic', group],
|
||||
queryFn: () => {
|
||||
return fetchViolationAnalyticStatistic(group)
|
||||
},
|
||||
select: (data: UseViolationStatistic | null) => {
|
||||
if (!data) {
|
||||
return null
|
||||
}
|
||||
return data;
|
||||
},
|
||||
retry: false
|
||||
});
|
||||
};
|
||||
Reference in New Issue
Block a user