mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-05 12:24:30 +01:00
9 lines
288 B
TypeScript
9 lines
288 B
TypeScript
import { API_BASE_URL } from '@/config'
|
|
|
|
export function toWebSocketUrl(pathWithQuery: string): string {
|
|
const base = API_BASE_URL || window.location.origin
|
|
const url = new URL(pathWithQuery, base)
|
|
url.protocol = url.protocol === 'https:' ? 'wss:' : 'ws:'
|
|
return url.toString()
|
|
}
|