* Generates an URL string from a map of url parameters * @param {{}} urlParameters - the map of parameters * @returns {string} - an URI string
(urlParameters)
| 494 | * @returns {string} - an URI string |
| 495 | */ |
| 496 | static urlString(urlParameters) { |
| 497 | const attr = []; |
| 498 | Object.keys(urlParameters).forEach(k => { |
| 499 | const v = urlParameters[k]; |
| 500 | if (v !== undefined) { |
| 501 | let value = v; |
| 502 | if (Array.isArray(v)) |
| 503 | value = '..' + v.join(','); |
| 504 | attr.push(encodeURI(k + '=' + value)); |
| 505 | } |
| 506 | }); |
| 507 | const url = window.location.pathname; |
| 508 | let res = url.substring(url.lastIndexOf('/') + 1); |
| 509 | if (attr.length > 0) { |
| 510 | res += '?' + attr.join('&'); |
| 511 | } |
| 512 | return res; |
| 513 | } |
| 514 | static updateURLParam(key, value, addToBrowserHistory = true) { |
| 515 | const currentParams = URLHandler.parameters; |
| 516 | currentParams[key] = value; |