|
|
@ -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 } |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|