add locale for document history view

This commit is contained in:
smanylov
2026-05-14 14:45:49 +07:00
parent 3a0ae93846
commit 6994edd216
3 changed files with 9 additions and 6 deletions
+3 -2
View File
@@ -166,7 +166,7 @@ export async function filePermisionChange(fileId: string, permissions: boolean)
}
}
export async function fetchHistoryView(page: number, size: number) {
export async function fetchHistoryView(page: number, size: number, locale: string) {
const token = await getSessionData('token');
try {
@@ -179,7 +179,8 @@ export async function fetchHistoryView(page: number, size: number) {
token: token,
action: 'history_view',
page: page,
size: size
size: size,
locale: locale
}
}),
headers: {
+3 -3
View File
@@ -20,11 +20,11 @@ export interface UseHistoryView {
uniqueCountryCount: number;
}
export const useHistoryView = (page: number, size: number) => {
export const useHistoryView = (page: number, size: number, locale: string) => {
return useQuery({
queryKey: ['violationStatistic', page, size],
queryKey: ['violationStatistic', page, size, locale],
queryFn: () => {
return fetchHistoryView(page, size)
return fetchHistoryView(page, size, locale)
},
select: (data: UseHistoryView | null) => {
if (!data) {
@@ -8,6 +8,7 @@ import { useReactTable, getCoreRowModel, getSortedRowModel, getPaginationRowMode
import { formatDate, formatDateTime } from '@/app/lib/formatDate';
import { useTranslations } from 'next-intl';
import { useViewport } from '@/app/hooks/useViewport';
import { useLocale } from 'next-intl';
export function TrackingHistoryView() {
const [pagination, setPagination] = useState({
@@ -16,6 +17,7 @@ export function TrackingHistoryView() {
});
const [sorting, setSorting] = useState<SortingState>([]);
const t = useTranslations('Global');
const locale = useLocale();
const {
data: apiResponse,
@@ -24,7 +26,7 @@ export function TrackingHistoryView() {
isError,
error,
refetch
} = useHistoryView(pagination.pageIndex, pagination.pageSize);
} = useHistoryView(pagination.pageIndex, pagination.pageSize, locale);
const tableData = apiResponse?.history || [];
const totalItems = apiResponse?.history.length || 0;