Add three new frontend page sections: - Industrial parks (khu-cong-nghiep): listing, detail, filter bar - Transfer listings (chuyen-nhuong): search, category tabs, detail - AI reports dashboard: list, create, viewer with TOC Includes components, API clients, hooks, server helpers, i18n keys, navigation links in public and dashboard layouts, and lint fixes. Co-Authored-By: Paperclip <noreply@paperclip.ing>
33 lines
974 B
TypeScript
33 lines
974 B
TypeScript
import { useQuery } from '@tanstack/react-query';
|
|
import { transferApi, type SearchTransferListingsParams } from '@/lib/chuyen-nhuong-api';
|
|
|
|
export const transferKeys = {
|
|
all: ['transfer'] as const,
|
|
search: (params: SearchTransferListingsParams) => ['transfer', 'search', params] as const,
|
|
detail: (id: string) => ['transfer', 'detail', id] as const,
|
|
stats: () => ['transfer', 'stats'] as const,
|
|
};
|
|
|
|
export function useTransferListingsSearch(params: SearchTransferListingsParams = {}) {
|
|
return useQuery({
|
|
queryKey: transferKeys.search(params),
|
|
queryFn: () => transferApi.search(params),
|
|
});
|
|
}
|
|
|
|
export function useTransferListingDetail(id: string) {
|
|
return useQuery({
|
|
queryKey: transferKeys.detail(id),
|
|
queryFn: () => transferApi.getById(id),
|
|
enabled: !!id,
|
|
});
|
|
}
|
|
|
|
export function useTransferStats() {
|
|
return useQuery({
|
|
queryKey: transferKeys.stats(),
|
|
queryFn: () => transferApi.getStats(),
|
|
staleTime: 5 * 60 * 1000,
|
|
});
|
|
}
|