Function buildQueryParams()
function buildQueryParams(params: QueryParamsSource, options?: QueryParamsSerializationOptions): string;Defined in: index.ts:785
Sorts query params by both key and value, returning a query params string
See Cache Keys for Requests for why builders need stable query params.
Treats included specially, splicing it into an array if it is a string and sorting the array.
The params given are never mutated: neither the object itself nor any array value it holds is reordered or replaced, so passing state that is also rendered (a tracked array of filter values, for instance) is safe.
Options:
- arrayFormat: 'bracket' | 'indices' | 'repeat' | 'comma'
'bracket': appends [] to the key for every value e.g. ids[]=1&ids[]=2 'indices': appends [i] to the key for every value e.g. ids[0]=1&ids[1]=2 'repeat': appends the key for every value e.g. ids=1&ids=2 'comma' (default): appends the key once with a comma separated list of values e.g. ids=1,2
Parameters
params
options?
QueryParamsSerializationOptions
Returns
string
A sorted query params string without the leading ?