Skip to content

Commit a4dc96e

Browse files
author
Silicon 01
committed
fix: use window.location.origin as fallback for buildUrl when baseUrl is empty
1 parent 9d220b6 commit a4dc96e

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

src/api.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ export function setCurrentAgent(agentId: string | null) {
2121

2222
// Helper to build URL with agent parameter
2323
function buildUrl(endpoint: string, params?: Record<string, string>): string {
24-
const url = new URL(`${_baseUrl}${endpoint}`);
24+
const base = _baseUrl || window.location.origin;
25+
const url = new URL(`${base}${endpoint}`);
2526
if (_currentAgent) {
2627
url.searchParams.set("agent", _currentAgent);
2728
}

0 commit comments

Comments
 (0)