Skip to content

Commit 4a36ae2

Browse files
fix: websocket url replacement method
1 parent d30fcf2 commit 4a36ae2

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

src/utils/api-ws.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,7 @@ import { getToken } from './api';
99

1010
export type * from './api';
1111

12-
export function getWsBase(): string {
13-
// We use the `baseURI` (from `<base/>` in index.html) to build the URL, which is corrected by httpd/nginx
14-
return document.baseURI.replace(/^http(s?):\/\//, 'ws$1://').replace(/\/+$/, '') + import.meta.env.VITE_WS_GATEWAY;
15-
}
12+
export const getWsBase = () => document.baseURI.replace(/^http:\/\//, 'ws://').replace(/^https:\/\//, 'wss://');
1613

1714
export function getUrlWithToken(baseUrl: string): string {
1815
const querySymbol = baseUrl.includes('?') ? '&' : '?';

0 commit comments

Comments
 (0)