UNPKG

@gpa-gemstone/common-pages

Version:
22 lines (21 loc) 1.24 kB
import { Application } from '@gpa-gemstone/application-typings'; import { Search } from '@gpa-gemstone/react-interactive'; import { Gemstone } from '../Gemstone'; /** * Custom hook to fetch and paginate searchable data from a read-only controller endpoint. * @typeParam T - The type of the records being searched. * @param page - The current page number to fetch. * @param sortField - The field to sort the results by. * @param searchFilter - The search filters to apply to the query. * @param ascending - Whether the results should be sorted in ascending order. * @param controllerPath - The path to the read-only controller endpoint. * @param ReFetchDataCounter - Optional counter that triggers a re-fetch whenever its value changes. * @returns An object containing the search results, the search status, the pagination status and the pagination info. */ declare const useSearchData: <T>(page: number, sortField: keyof T, searchFilter: Search.IFilter<T>[], ascending: boolean, controllerPath: string, ReFetchDataCounter?: number) => { SearchResults: T[]; SearchStatus: Application.Types.Status; PaginationStatus: Application.Types.Status; PageInfo: Gemstone.Types.IPageInfo; }; export default useSearchData;