web-manager 3.2.60 → 3.2.61
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/utilities.js +15 -0
- package/package.json +1 -1
package/lib/utilities.js
CHANGED
@@ -144,4 +144,19 @@ Utilities.getContext = function () {
|
|
144
144
|
}
|
145
145
|
}
|
146
146
|
|
147
|
+
// Navigate fn that takes a url and an object of query params
|
148
|
+
Utilities.navigate = function (url, params) {
|
149
|
+
// Should work if the url is a relative path too
|
150
|
+
var newUrl = new URL(url, window.location.origin);
|
151
|
+
|
152
|
+
// Add the params to the url
|
153
|
+
Object.keys(params).forEach(function (key) {
|
154
|
+
newUrl.searchParams.set(key, params[key]);
|
155
|
+
});
|
156
|
+
|
157
|
+
// Navigate to the new url
|
158
|
+
window.location.href = newUrl;
|
159
|
+
}
|
160
|
+
|
161
|
+
|
147
162
|
module.exports = Utilities;
|
package/package.json
CHANGED