xieb
2025-01-15 1eda23a6bd69f80f2f3e0f2591002f6c1a0a38de
遥控器上云
2 files modified
4 ■■■ changed files
src/hooks/use-connect-websocket.ts 2 ●●●●● patch | view | raw | blame | history
src/websocket/util/config.ts 2 ●●● patch | view | raw | blame | history
src/hooks/use-connect-websocket.ts
@@ -8,8 +8,6 @@
 * @param messageHandler
 */
export function useConnectWebSocket (messageHandler: MessageHandler, url?:string) {
  console.log('1112233344:',url)
  console.log('11112321312:',getWebsocketUrl())
  const webSocket = new ConnectWebSocket(url || getWebsocketUrl())
  onMounted(() => {
src/websocket/util/config.ts
@@ -14,7 +14,7 @@
export function getWebsocketUrl () {
  const token: string = localStorage.getItem(ELocalStorageKey.Token) || '' as string
  // const url = CURRENT_CONFIG.websocketURL
  const url = (window?.globalApiConfig?.baseUrl?.wsBaseUrl || import.meta.env.VITE_WS_API_URL) + '?x-auth-token=' + encodeURI(token)
  const url = (window?.globalApiConfig?.baseUrl?.wsBaseUrl || import.meta.env.VITE_WS_API_URL) + '?x-auth-token=' + encodeURI(token.replace('bearer ', ''))
  return url
}