add monitoring stats fetch

This commit is contained in:
smanylov
2026-04-01 11:24:47 +07:00
parent b89e5b4c6b
commit dd483cb628
5 changed files with 91 additions and 3 deletions
@@ -0,0 +1,29 @@
import { useQuery } from '@tanstack/react-query';
import { fetchMonitoringStats } from '@/app/actions/monitoringActions';
interface MonitoringStats {
total_searches: number;
searches_by_status: {
processing: number;
completed: number;
failed: number;
total: number;
};
recent_searches: any[];
}
export const useMonitoringStats = () => {
return useQuery({
queryKey: ['monitoringStats'],
queryFn: () => {
return fetchMonitoringStats()
},
select: (data: MonitoringStats | null) => {
if (!data) {
return null
}
return data;
},
retry: false
});
};