add monitoring stats fetch
This commit is contained in:
@@ -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
|
||||
});
|
||||
};
|
||||
Reference in New Issue
Block a user