Skip to main content

Query Params

Overview

This store is used to manage the query parameters. It is used to store the query parameters for the current page.

Basic Features

setFromUrl()

Sets the state from the given URL by extracting query parameters and updating the store.

setFromUrl(url: string): void
ParameterTypeDescription
urlstringThe URL from which to extract params

addFilter()

Adds a filter to the store's state.

addFilter(filter: LegacyFilter): void
ParameterTypeDescription
filterLegacyFilterThe filter to add

updateFilter()

Updates the filter with the given value.

updateFilter(filter: LegacyFilter): void
ParameterTypeDescription
filterLegacyFilterThe filter to update

clearFilter()

Clears the filter.

clearFilter(): void

clearBasket()

Clears the basket from the state.

clearBasket(): void

patch()

Patches the query parameters with the given value.

patch(params: Partial<QueryParamsState>): void
ParameterTypeDescription
paramsPartial<QueryParamsState>The parameters to patch with

getFilter()

Retrieves a filter object based on the provided field or name.

getFilter({ field, name }: { field: string | undefined; name: string | undefined }): Partial<LegacyFilter & { count: number }> | null
ParameterTypeDescription
fieldstringThe field to search for in filters
namestringThe name to search for in filters