1 import { useQueryParams } from "../../../../hooks/use-query-params"
2
3 export const useCountryTableQuery = ({
4 pageSize,
5 prefix,
6 }: {
7 pageSize: number
8 prefix?: string
9 }) => {
10 const raw = useQueryParams(["order", "q", "offset"], prefix)
11
12 const { offset, order, q } = raw
13
14 const searchParams = {
15 limit: pageSize,
16 offset: offset ? parseInt(offset, 10) : 0,
17 order,
18 q,
19 }
20
21 return {
22 searchParams,
23 raw,
24 }
25 }