Commit 49231cce authored by Clement Ho's avatar Clement Ho

Refactor getUrlParamsArray()

parent bcb00bdc
......@@ -80,9 +80,7 @@
}
loadSearchParamsFromURL() {
// We can trust that each param has one & since values containing & will be encoded
// Remove the first character of search as it is always ?
const params = window.location.search.slice(1).split('&');
const params = gl.utils.getUrlParamsArray();
let inputValues = [];
params.forEach((p) => {
......
......@@ -124,6 +124,12 @@
return parsedUrl.pathname.charAt(0) === '/' ? parsedUrl.pathname : '/' + parsedUrl.pathname;
};
gl.utils.getUrlParamsArray = function () {
// We can trust that each param has one & since values containing & will be encoded
// Remove the first character of search as it is always ?
return window.location.search.slice(1).split('&');
}
gl.utils.getParameterByName = function(name) {
var url = window.location.href;
var param = name.replace(/[[\]]/g, '\\$&');
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment