Skip to content

chore(frontend): adopt getApiBase() in JS utility files SecretsApiClient, FrontendHealthMonitor, OptimizedHealthMonitor #3725

@mrveiss

Description

@mrveiss

Summary

Three legacy .js utility files in autobot-frontend/src/utils/ were missed by the getApiBase() TypeScript sweep (#3629) because the original grep used --type ts. All three make real API/fetch calls with hardcoded /api/ paths.

Files to Fix

File Occurrences Type
src/utils/SecretsApiClient.js 3 this.apiClient.post/get() calls
src/utils/FrontendHealthMonitor.js 1 fetch('/api/health', ...)
src/utils/OptimizedHealthMonitor.js 1 fetch('/api/system/health', ...)

Do NOT change

  • src/utils/ApiClientMonitor.js — path strings in a monitoring descriptor map, not HTTP calls
  • src/utils/ApiEndpointMapper.js — path strings used as map keys/patterns
  • src/utils/ErrorHandler.jsmessage.includes('/api/prompts/') checks error message content, not a URL

Fix

In each file, add the import at the top and replace hardcoded paths:

import { getApiBase } from '@/config/ssot-config'

// SecretsApiClient.js
- this.apiClient.post('/api/secrets/', secretData)
+ this.apiClient.post(`${getApiBase()}/secrets/`, secretData)

// FrontendHealthMonitor.js
- fetch('/api/health', ...)
+ fetch(`${getApiBase()}/health`, ...)

// OptimizedHealthMonitor.js
- fetch('/api/system/health', ...)
+ fetch(`${getApiBase()}/system/health`, ...)

Verification

grep -n "'/api/" autobot-frontend/src/utils/SecretsApiClient.js \
  autobot-frontend/src/utils/FrontendHealthMonitor.js \
  autobot-frontend/src/utils/OptimizedHealthMonitor.js
# Should return 0 results

Discovered as gap during #3629 implementation (noted in PR body), 2026-04-07.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions