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');
|
const token = await getSessionData('token');
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -179,7 +179,8 @@ export async function fetchHistoryView(page: number, size: number) {
|
|||||||
token: token,
|
token: token,
|
||||||
action: 'history_view',
|
action: 'history_view',
|
||||||
page: page,
|
page: page,
|
||||||
size: size
|
size: size,
|
||||||
|
locale: locale
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
headers: {
|
headers: {
|
||||||
|
|||||||
@@ -20,11 +20,11 @@ export interface UseHistoryView {
|
|||||||
uniqueCountryCount: number;
|
uniqueCountryCount: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const useHistoryView = (page: number, size: number) => {
|
export const useHistoryView = (page: number, size: number, locale: string) => {
|
||||||
return useQuery({
|
return useQuery({
|
||||||
queryKey: ['violationStatistic', page, size],
|
queryKey: ['violationStatistic', page, size, locale],
|
||||||
queryFn: () => {
|
queryFn: () => {
|
||||||
return fetchHistoryView(page, size)
|
return fetchHistoryView(page, size, locale)
|
||||||
},
|
},
|
||||||
select: (data: UseHistoryView | null) => {
|
select: (data: UseHistoryView | null) => {
|
||||||
if (!data) {
|
if (!data) {
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import { useReactTable, getCoreRowModel, getSortedRowModel, getPaginationRowMode
|
|||||||
import { formatDate, formatDateTime } from '@/app/lib/formatDate';
|
import { formatDate, formatDateTime } from '@/app/lib/formatDate';
|
||||||
import { useTranslations } from 'next-intl';
|
import { useTranslations } from 'next-intl';
|
||||||
import { useViewport } from '@/app/hooks/useViewport';
|
import { useViewport } from '@/app/hooks/useViewport';
|
||||||
|
import { useLocale } from 'next-intl';
|
||||||
|
|
||||||
export function TrackingHistoryView() {
|
export function TrackingHistoryView() {
|
||||||
const [pagination, setPagination] = useState({
|
const [pagination, setPagination] = useState({
|
||||||
@@ -16,6 +17,7 @@ export function TrackingHistoryView() {
|
|||||||
});
|
});
|
||||||
const [sorting, setSorting] = useState<SortingState>([]);
|
const [sorting, setSorting] = useState<SortingState>([]);
|
||||||
const t = useTranslations('Global');
|
const t = useTranslations('Global');
|
||||||
|
const locale = useLocale();
|
||||||
|
|
||||||
const {
|
const {
|
||||||
data: apiResponse,
|
data: apiResponse,
|
||||||
@@ -24,7 +26,7 @@ export function TrackingHistoryView() {
|
|||||||
isError,
|
isError,
|
||||||
error,
|
error,
|
||||||
refetch
|
refetch
|
||||||
} = useHistoryView(pagination.pageIndex, pagination.pageSize);
|
} = useHistoryView(pagination.pageIndex, pagination.pageSize, locale);
|
||||||
|
|
||||||
const tableData = apiResponse?.history || [];
|
const tableData = apiResponse?.history || [];
|
||||||
const totalItems = apiResponse?.history.length || 0;
|
const totalItems = apiResponse?.history.length || 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user