Fix pager.

This commit is contained in:
Brian Cao 2023-10-15 15:52:34 -07:00
parent aa5d81d6a1
commit 0487e48dd2
2 changed files with 4 additions and 3 deletions

View File

@ -45,11 +45,11 @@ export function DataTable({
const noResults = Boolean(!isLoading && query && !hasData);
const handleSearch = query => {
setParams({ ...params, query, page: params.query ? page : 1 });
setParams({ ...params, query, page: params.page ? page : 1 });
};
const handlePageChange = page => {
setParams({ ...params, page });
setParams({ ...params, query, page });
};
if (error) {

View File

@ -1,7 +1,8 @@
import { useState } from 'react';
import { useApi } from 'components/hooks/useApi';
import { UseQueryOptions } from '@tanstack/react-query';
export function useFilterQuery(key: any[], fn, options?: any) {
export function useFilterQuery(key: any[], fn, options?: UseQueryOptions) {
const [params, setParams] = useState({
query: '',
page: 1,