Pattern: ThemeHttpStorageService had inconsistent URL construction — ...

Documentation for Sessions

🎨 Pattern: ThemeHttpStorageService had inconsistent URL construction — ...

Date: 2026-02-25
Time: 20:19:05 UTC
Session: gspace1-141.12
Agent: angular
Confidence: 95%
Status: ✅ Documented


📋 Decision Context

Question:

ThemeHttpStorageService had inconsistent URL construction — some methods used ${this.baseUrl}/themes/... while others hardcoded /api/themes/... Should URLs be standardized?

Task: Standardize URL construction in ThemeHttpStorageService


🎯 Decision Made

Chosen:

Standardize all methods to use ${this.baseUrl}/... (injected API_BASE_URL)

Options Considered:

  1. Standardize all methods to use ${this.baseUrl}/... (injected API_BASE_URL)
  2. Standardize all methods to use hardcoded /api/... (relies on Angular proxy)
  3. Use a centralized buildUrl() helper method

💭 Reasoning

The inconsistency created a fragile coupling to the Angular proxy configuration. Methods using ${this.baseUrl} work in both dev (with proxy) and prod (with real domain). Methods hardcoding /api/... only work if the proxy is configured identically. Standardizing on ${this.baseUrl} makes the service self-contained and proxy-agnostic. Five methods were updated: getTheme, deleteTheme, updateTheme, saveThemeSetting, getThemeSetting. A buildUrl helper was considered but rejected as over-engineering for simple string interpolation. EARLY WARNING: Any HTTP service that mixes injected baseUrl with hardcoded paths is a code smell. Search pattern: grep for '/api/' in Angular services that also inject a *_URL token.


📁 Files Involved


🔗 Related


Auto-generated by MCP Smart Consolidation