Update the base URL and persist it to localStorage if non-empty.
(value: string)
| 78 | |
| 79 | /** Update the base URL and persist it to localStorage if non-empty. */ |
| 80 | setBaseUrl(value: string): void { |
| 81 | const normalized = (value || '').trim().replace(/\/$/, ''); |
| 82 | this._baseUrl = normalized === window.location.origin ? '' : normalized; |
| 83 | if (this._baseUrl) { |
| 84 | localStorage.setItem('space_api_base', this._baseUrl); |
| 85 | } else { |
| 86 | localStorage.removeItem('space_api_base'); |
| 87 | } |
| 88 | } |
| 89 | |
| 90 | /** Build a fully-qualified URL for the given API path. */ |
| 91 | url(path: string): string { |