Fix: How to fix services using hardcoded /api relative URLs that ...
Documentation for Sessions
📝 Fix: How to fix services using hardcoded /api relative URLs that ...
Date: 2026-01-28
Time: 15:28:49 UTC
Session: editor2-72.75
Agent: angular
Confidence: 100%
Status: ✅ Documented
📋 Decision Context
Question:
How to fix services using hardcoded /api relative URLs that break in production?
Task: Not specified
🎯 Decision Made
Chosen:
Fix each service individually to use API_BASE_URL injection token. Updated 7 files: widgets-api.service.ts, widget-promotion.service.ts, module-export.service.ts, module-creation-wizard.component.ts, flow-picker-modal.component.ts, flow-attacher.component.ts, universal-asset-registry.service.ts. Pattern: replace 'private readonly API_BASE = /api' with 'private readonly baseUrl = inject(API_BASE_URL)' and update all usages.
Options Considered:
- Add HTTP interceptor to prepend base URL
- Fix each service individually to use API_BASE_URL token
- Use environment.backendApiUrl directly in each service
💭 Reasoning
The API_BASE_URL token is already properly provided in app.config.ts with environment.backendApiUrl value. Using the injection token is the established pattern in this codebase (used by space-api.service.ts, backend-module-api.service.ts, etc). This ensures all services automatically get the correct URL (localhost:3000 in dev, api.gograb.space in prod) based on the environment file replacement during build.
📁 Files Involved
- No files specified
🔗 Related
- Decision ID:
dev_1769614125869_b0erj8r - Session: 72
- Workspace: editor2
Auto-generated by MCP Smart Consolidation