add locale for document history view
This commit is contained in:
@@ -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: {
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user