Browse Source

refactor: socket url population

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/1668/head
Pranav C 3 years ago
parent
commit
98a75f0da4
  1. 6
      packages/nc-gui/plugins/tele.js

6
packages/nc-gui/plugins/tele.js

@ -14,12 +14,8 @@ export default function({
if (socket) { if (socket) {
socket.disconnect() socket.disconnect()
} }
const isUrl = $axios.defaults.baseURL.startsWith('http') const url = new URL($axios.defaults.baseURL, window.location.href.split(/[?#]/)[0]).href
const url = isUrl ? $axios.defaults.baseURL : window.location.origin
const path = isUrl ? undefined : ($axios.defaults.baseURL === '..' ? window.location.pathname.split('/').slice(0, -1).join('/') : $axios.defaults.baseURL)
socket = io(url, { socket = io(url, {
path,
extraHeaders: { 'xc-auth': token } extraHeaders: { 'xc-auth': token }
}) })

Loading…
Cancel
Save