|
1
|
import { HttpTypes } from "@medusajs/types" |
|
2
|
import { useQueryParams } from "../../../hooks/use-query-params" |
|
3
|
|
|
4
|
export const useLocationListTableQuery = ({ |
|
5
|
pageSize = 20, |
|
6
|
prefix, |
|
7
|
}: { |
|
8
|
pageSize?: number |
|
9
|
prefix?: string |
|
10
|
}) => { |
|
11
|
const queryObject = useQueryParams(["order", "offset", "q"], prefix) |
|
12
|
|
|
13
|
const { offset, ...rest } = queryObject |
|
14
|
|
|
15
|
const searchParams: HttpTypes.AdminStockLocationListParams = { |
|
16
|
limit: pageSize, |
|
17
|
offset: offset ? Number(offset) : 0, |
|
18
|
...rest, |
|
19
|
} |
|
20
|
|
|
21
|
return searchParams |
|
22
|
} |