diff options
Diffstat (limited to 'app/assets/javascripts/lib/utils/common_utils.js.es6')
-rw-r--r-- | app/assets/javascripts/lib/utils/common_utils.js.es6 | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/app/assets/javascripts/lib/utils/common_utils.js.es6 b/app/assets/javascripts/lib/utils/common_utils.js.es6 index 276ff01ab89..9c010e49284 100644 --- a/app/assets/javascripts/lib/utils/common_utils.js.es6 +++ b/app/assets/javascripts/lib/utils/common_utils.js.es6 @@ -256,19 +256,19 @@ */ w.gl.utils.setParamInURL = (param, value) => { let search; + const locationSearch = window.location.search; - if (window.location.search.length === 0) { + if (locationSearch.length === 0) { search = `?${param}=${value}`; } - if (window.location.search.indexOf(param) !== -1) { + if (locationSearch.indexOf(param) !== -1) { const regex = new RegExp(param + '=\\d'); - search = window.location.search.replace(regex, `${param}=${value}`); + search = locationSearch.replace(regex, `${param}=${value}`); } - if (window.location.search.length && - window.location.search.indexOf(param) === -1) { - search = `${window.location.search}&${param}=${value}`; + if (locationSearch.length && locationSearch.indexOf(param) === -1) { + search = `${locationSearch}&${param}=${value}`; } return search; |