提交 ad68a92f 作者: 方治民

feat(util): 统一 Stomp API 地址

上级 470759fa
...@@ -2,9 +2,8 @@ import type { Client, Frame, Message } from 'stompjs' ...@@ -2,9 +2,8 @@ import type { Client, Frame, Message } from 'stompjs'
import SockJS from 'sockjs-client/dist/sockjs.min.js' import SockJS from 'sockjs-client/dist/sockjs.min.js'
import Stomp from 'stompjs' import Stomp from 'stompjs'
import { getToken } from '/@/utils/auth' import { getToken } from '/@/utils/auth'
import { useGlobSetting } from '/@/hooks/setting'
import { useMessage } from '/@/hooks/web/useMessage' import { useMessage } from '/@/hooks/web/useMessage'
import { apiUrl } from '/@/utils/http/axios' import { API_URL, API_URL_PREFIX } from '/@/utils/net'
const { createMessage } = useMessage() const { createMessage } = useMessage()
...@@ -231,8 +230,7 @@ class StompInstance { ...@@ -231,8 +230,7 @@ class StompInstance {
} }
} }
const globSetting = useGlobSetting() const baseUrl = API_URL + API_URL_PREFIX
const baseUrl = apiUrl + globSetting.urlPrefix
const instance = new StompInstance({ const instance = new StompInstance({
url: `${baseUrl}/stomp/sock-js`, url: `${baseUrl}/stomp/sock-js`,
debug: false, debug: false,
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论