()
| 276 | |
| 277 | // Create apiclient instance with endpoint from storage or default |
| 278 | export const getEndpointFromStorage = () => { |
| 279 | let endpoint; |
| 280 | try { |
| 281 | endpoint = storage.getItem(LOCAL_STORAGE_KEY_V1) || DEFAULT_ENDPOINT; |
| 282 | } catch { |
| 283 | // Fallback if storage is not available |
| 284 | endpoint = DEFAULT_ENDPOINT; |
| 285 | } |
| 286 | |
| 287 | return sanitizeEndpoint(endpoint.replace("/_pd/api/v1", "").replace("/_pd/api/v2", "")); // compatible with old endpoint |
| 288 | }; |
| 289 | |
| 290 | /** |
| 291 | * @deprecated Use getEndpointFromStorage instead |
no test coverage detected