diff --git a/src/app/actions/trackingActions.ts b/src/app/actions/trackingActions.ts index dd1125a..7755769 100644 --- a/src/app/actions/trackingActions.ts +++ b/src/app/actions/trackingActions.ts @@ -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: { diff --git a/src/app/hooks/react-query/useHistoryView.ts b/src/app/hooks/react-query/useHistoryView.ts index e61fefc..2299195 100644 --- a/src/app/hooks/react-query/useHistoryView.ts +++ b/src/app/hooks/react-query/useHistoryView.ts @@ -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) { diff --git a/src/app/ui/tracking-page/tracking-history-view.tsx b/src/app/ui/tracking-page/tracking-history-view.tsx index 584eb48..1520aa7 100644 --- a/src/app/ui/tracking-page/tracking-history-view.tsx +++ b/src/app/ui/tracking-page/tracking-history-view.tsx @@ -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([]); 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;