add TrackingHistoryView

This commit is contained in:
smanylov
2026-05-06 19:03:29 +07:00
parent af6b997ceb
commit 8a72dbaf68
6 changed files with 496 additions and 39 deletions
@@ -0,0 +1,37 @@
import { useQuery } from '@tanstack/react-query';
import { fetchHistoryView } from '@/app/actions/trackingActions';
export interface HistoryViewItem {
city: string;
country: string;
viewer: string;
document: string;
view_date: string;
}
export interface UseHistoryView {
documentsCount: number;
history: HistoryViewItem[];
pageNumber: number;
pageSize: number;
totalElements: number;
totalPages: number;
uniqueCityCount: number;
uniqueCountryCount: number;
}
export const useHistoryView = (page: number, size: number) => {
return useQuery({
queryKey: ['violationStatistic'],
queryFn: () => {
return fetchHistoryView(page, size)
},
select: (data: UseHistoryView | null) => {
if (!data) {
return null
}
return data;
},
retry: false
});
};