MCPcopy Create free account
hub / github.com/Tong89/smartNode / resolveApiBase

Function resolveApiBase

frontend/src/api/client.ts:31–44  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

29 * 4. Empty string (same origin).
30 */
31export function resolveApiBase(): string {
32 const params = new URLSearchParams(window.location.search);
33 const configured = params.get('api') || localStorage.getItem('space_api_base');
34 if (configured) {
35 return configured.replace(/\/$/, '');
36 }
37 if (
38 window.location.protocol === 'file:' ||
39 (window.location.port !== '' && window.location.port !== '5000')
40 ) {
41 return 'http://127.0.0.1:5000';
42 }
43 return '';
44}
45
46/**
47 * Error thrown whenever the server returns a non-2xx status or the request

Callers 2

client.test.tsFile · 0.90
constructorMethod · 0.70

Calls 1

getMethod · 0.45

Tested by

no test coverage detected