Merge pull request '前端:修复wss连接失败的问题' (#53) from feature-nxdev into main

Reviewed-on: #53
This commit was merged in pull request #53.
This commit is contained in:
2026-01-29 23:44:46 +08:00
2 changed files with 8 additions and 6 deletions
+1 -1
View File
@@ -1,4 +1,4 @@
#VITE_API_BASE_URL = http://localhost:5202/api
#VITE_SIGNALR_BASE_URL = http://localhost:5202/chat
VITE_API_BASE_URL = https://im.test.nxsir.cn/api
VITE_SIGNALR_BASE_URL = https://im.test.nxsir.cn/chat
VITE_SIGNALR_BASE_URL = https://im.test.nxsir.cn/chat/
+4 -2
View File
@@ -18,9 +18,11 @@ export const useSignalRStore = defineStore('signalr', {
async initSignalR() {
const message = useMessage()
const authStore = useAuthStore()
const url = import.meta.env.VITE_SIGNALR_BASE_URL || 'http://localhost:5202/chat';
const url = import.meta.env.VITE_SIGNALR_BASE_URL || 'http://localhost:5202/chat/';
this.connection = new signalR.HubConnectionBuilder()
.withUrl(url, {
.withUrl(url,
{
accessTokenFactory: async () => {
if (authStore.isTokenExpired) {
const res = await authService.refresh(authStore.refreshToken)