Raw
1 import { HttpTypes } from "@medusajs/types"
2 import { useQueryParams } from "../../use-query-params"
3
4 type UseFulfillmentProviderTableQueryProps = {
5 prefix?: string
6 pageSize?: number
7 }
8
9 export const useFulfillmentProvidersTableQuery = ({
10 prefix,
11 pageSize = 20,
12 }: UseFulfillmentProviderTableQueryProps) => {
13 const queryObject = useQueryParams(
14 ["offset", "q", "stock_location_id"],
15 prefix
16 )
17
18 const { offset, q, stock_location_id } = queryObject
19
20 const searchParams: HttpTypes.AdminGetFulfillmentProvidersParams = {
21 limit: pageSize,
22 offset: offset ? Number(offset) : 0,
23 stock_location_id,
24 q,
25 }
26
27 return {
28 searchParams,
29 raw: queryObject,
30 }
31 }