fix state strings bug

This commit is contained in:
Esteban Abaroa
2023-05-10 23:13:24 +00:00
parent 0e77779f1e
commit 7849201a2b
3 changed files with 13 additions and 4 deletions
+10 -1
View File
@@ -21,10 +21,19 @@ const useStateString = (clients) => {
}
}
const getClientHost = (clientUrl) => {
try {
return new URL(clientUrl).hostname || clientUrl
}
catch (e) {
return clientUrl
}
}
let stateString = ''
for (const state in states) {
const clientUrls = states[state]
const clientHosts = clientUrls.filter(isValidUrl).map(clientUrl => new URL(clientUrl).hostname)
const clientHosts = clientUrls.filter(isValidUrl).map(clientUrl => getClientHost(clientUrl))
// if there are no valid hosts, skip this state
if (clientHosts.length === 0) {