urlParams
Helper functions setting, getting, updating and clearing query parameters in the URL-field.
getUrlParams() ⇨ Object
Section titled “getUrlParams() ⇨ Object”Get parameters from the URL-field.
Returns: Object
- Parameters in URL-field.
import { getUrlParams } from '@soleil-se/app-util/client';
const params = getUrlParams();
getUrlParam() ⇨ String|Array[String]
Section titled “getUrlParam() ⇨ String|Array[String]”Get single parameter from the URL-field.
Returns: String|Array[String]
- Parameter value.
import { getUrlParam } from '@soleil-se/app-util/client';
const param = getUrlParam('name');
setUrlParams(params)
Section titled “setUrlParams(params)”Set parameters in the URL-field, overwriting other parameters.
Param | Type | Default | Description |
---|---|---|---|
params | Object | Object with parameters to set in the URL-field. |
import { setUrlParams } from '@soleil-se/app-util/client';
setUrlParams({ foo: 'bar', arr: [1, 2] });
updateUrlParams(params)
Section titled “updateUrlParams(params)”Update parameters in the URL-field, merging with existing parameters
Returns: String
- Stringified parameters.
Param | Type | Default | Description |
---|---|---|---|
params | Object | Object with parameters to add to the URL-field. |
import { updateUrlParams } from '@soleil-se/app-util/client';
updateUrlParams({ foo: 'bar', arr: [1, 2] });
clearUrlParams()
Section titled “clearUrlParams()”Clear parameters in the URL-field
import { clearUrlParams } from '@soleil-se/app-util/client';
clearUrlParams();