Hoppa till innehåll

urlParams

Helper functions setting, getting, updating and clearing query parameters in the URL-field.

Get parameters from the URL-field.

Returns: Object - Parameters in URL-field.

import { getUrlParams } from '@soleil-se/app-util/client';
const params = getUrlParams();

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');

Set parameters in the URL-field, overwriting other parameters.

ParamTypeDefaultDescription
paramsObjectObject with parameters to set in the URL-field.
import { setUrlParams } from '@soleil-se/app-util/client';
setUrlParams({ foo: 'bar', arr: [1, 2] });

Update parameters in the URL-field, merging with existing parameters

Returns: String - Stringified parameters.

ParamTypeDefaultDescription
paramsObjectObject with parameters to add to the URL-field.
import { updateUrlParams } from '@soleil-se/app-util/client';
updateUrlParams({ foo: 'bar', arr: [1, 2] });

Clear parameters in the URL-field

import { clearUrlParams } from '@soleil-se/app-util/client';
clearUrlParams();