ui(admin): cleanup table hooks, more...
This commit is contained in:
parent
7524bbe8ee
commit
6879ca4054
11 changed files with 11 additions and 24 deletions
|
@ -7,22 +7,9 @@ import Spinner from '@/components/elements/Spinner';
|
|||
import styled from 'styled-components/macro';
|
||||
import tw from 'twin.macro';
|
||||
import { PaginatedResult, PaginationDataSet } from '@/api/http';
|
||||
import { ListContext as TableHooks } from '@/api/admin';
|
||||
|
||||
interface Hooks<T> {
|
||||
page: number;
|
||||
setPage: (page: ((p: number) => number) | number) => void;
|
||||
|
||||
filters: T | null;
|
||||
setFilters: (filters: ((f: T | null) => T | null) | T | null) => void;
|
||||
|
||||
sort: string | null;
|
||||
setSort: (sort: string | null) => void;
|
||||
|
||||
sortDirection: boolean;
|
||||
setSortDirection: (direction: ((p: boolean) => boolean) | boolean) => void;
|
||||
}
|
||||
|
||||
export function useTableHooks<T> (): Hooks<T> {
|
||||
export function useTableHooks<T> (): TableHooks<T> {
|
||||
const [ page, setPage ] = useState<number>(1);
|
||||
const [ filters, setFilters ] = useState<T | null>(null);
|
||||
const [ sort, setSortState ] = useState<string | null>(null);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue