[web] Change to template literals

This commit is contained in:
Alain Nussbaumer
2023-11-23 20:23:40 +01:00
parent 5cd63294a2
commit 406c87f765
13 changed files with 71 additions and 115 deletions

View File

@@ -151,21 +151,17 @@ export default {
protocol = 'wss://'
}
let wsUrl =
protocol +
window.location.hostname +
':' +
let wsUrl = `${protocol + window.location.hostname}:${
vm.$store.state.config.websocket_port
}`
if (import.meta.env.DEV && import.meta.env.VITE_OWNTONE_URL) {
// If we are running in development mode, construct the websocket url
// from the host of the environment variable VITE_OWNTONE_URL
const owntoneUrl = new URL(import.meta.env.VITE_OWNTONE_URL)
wsUrl =
protocol +
owntoneUrl.hostname +
':' +
wsUrl = `${protocol + owntoneUrl.hostname}:${
vm.$store.state.config.websocket_port
}`
}
const socket = new ReconnectingWebSocket(wsUrl, 'notify', {