@progress/sitefinity-nextjs-sdk
Version:
Provides OOB widgets developed using the Next.js framework, which includes an abstraction layer for Sitefinity communication. Additionally, it offers an expanded API, typings, and tools for further development and integration.
19 lines (18 loc) • 625 B
JavaScript
const FILTER_QUERY_PARAM = 'filter';
export function getQueryParams(currentQueryParams) {
const queryParams = {};
currentQueryParams?.forEach((v, k) => {
queryParams[k] = v;
});
return queryParams;
}
export function setQueryParams(queryStringParams) {
const queryParams = Object.entries(queryStringParams)
.map(([key, value]) => {
const encodedKey = encodeURIComponent(key);
const encodedValue = key === FILTER_QUERY_PARAM ? value || '' : encodeURIComponent(value || '');
return `${encodedKey}=${encodedValue}`;
})
.join('&');
return queryParams;
}