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:

  1. Add HTTP interceptor to prepend base URL
  2. Fix each service individually to use API_BASE_URL token
  3. 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


🔗 Related


Auto-generated by MCP Smart Consolidation