willba-component-library 0.1.29 → 0.1.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.js
CHANGED
|
@@ -8144,6 +8144,7 @@ function useFilterBar(_a) {
|
|
|
8144
8144
|
var currentSearchParams = new URLSearchParams(window.location.search);
|
|
8145
8145
|
var updatedParams = new URLSearchParams();
|
|
8146
8146
|
try {
|
|
8147
|
+
// Copy existing parameters to updatedParams
|
|
8147
8148
|
for (var _d = __values(currentSearchParams.entries()), _e = _d.next(); !_e.done; _e = _d.next()) {
|
|
8148
8149
|
var _f = __read(_e.value, 2), key = _f[0], value = _f[1];
|
|
8149
8150
|
updatedParams.append(key, value);
|
|
@@ -8157,12 +8158,15 @@ function useFilterBar(_a) {
|
|
|
8157
8158
|
finally { if (e_1) throw e_1.error; }
|
|
8158
8159
|
}
|
|
8159
8160
|
try {
|
|
8161
|
+
// Update parameters based on newParams
|
|
8160
8162
|
for (var _g = __values(Object.entries(newParams)), _h = _g.next(); !_h.done; _h = _g.next()) {
|
|
8161
8163
|
var _j = __read(_h.value, 2), key = _j[0], value = _j[1];
|
|
8162
8164
|
if (value) {
|
|
8165
|
+
console.log(value);
|
|
8163
8166
|
updatedParams.set(key, value.toString());
|
|
8164
8167
|
}
|
|
8165
8168
|
else {
|
|
8169
|
+
// Remove parameter if value is falsy
|
|
8166
8170
|
updatedParams.delete(key);
|
|
8167
8171
|
}
|
|
8168
8172
|
}
|
|
@@ -8174,12 +8178,10 @@ function useFilterBar(_a) {
|
|
|
8174
8178
|
}
|
|
8175
8179
|
finally { if (e_2) throw e_2.error; }
|
|
8176
8180
|
}
|
|
8177
|
-
console.log(
|
|
8178
|
-
// Get the current URL without the query string
|
|
8181
|
+
console.log(updatedParams.toString());
|
|
8179
8182
|
var baseUrl = window.location.origin + window.location.pathname;
|
|
8180
8183
|
// Construct the updated URL with the modified query parameters
|
|
8181
8184
|
var updatedUrl = "".concat(baseUrl, "?").concat(updatedParams.toString());
|
|
8182
|
-
// Replace the current URL with the updated URL in the browser's history
|
|
8183
8185
|
return (window.location.href = updatedUrl);
|
|
8184
8186
|
}
|
|
8185
8187
|
else {
|