* Generates an URL string from a map of url parameters * @param {{}} urlParameters - the map of parameters * @returns {string} - an URI string
(urlParameters: object)
| 69 | * @returns {string} - an URI string |
| 70 | */ |
| 71 | static urlString(urlParameters: object) { |
| 72 | const attr = []; |
| 73 | Object.keys(urlParameters).forEach(k => { |
| 74 | const v = urlParameters[k]; |
| 75 | if (v !== undefined) { |
| 76 | let value = v; |
| 77 | if (Array.isArray(v)) value = '..' + v.join(','); |
| 78 | attr.push(encodeURI(k + '=' + value)) |
| 79 | } |
| 80 | }); |
| 81 | |
| 82 | |
| 83 | const url = window.location.pathname; |
| 84 | let res = url.substring(url.lastIndexOf('/') + 1); |
| 85 | if (attr.length > 0) { |
| 86 | res += '?' + attr.join('&') |
| 87 | } |
| 88 | |
| 89 | return res; |
| 90 | } |
| 91 | |
| 92 | static updateURLParam(key: string, value: string | any[], addToBrowserHistory = true) { |
| 93 | const currentParams = URLHandler.parameters; |