GitHub Codespaces forwards each port as its own subdomain (e.g.
name-5300.app.github.dev) served over 443, not as host:port. The client
built the API URL as `${hostname}:5300`, producing
name-4200.app.github.dev:5300, which is unreachable (ERR_ADDRESS_UNREACHABLE).
Move the URL resolution into a small pure helper (resolveApiBaseUrl in
api-url.ts) that transparently rewrites the forwarded-port host, so the
service just asks for a base URL and the port-forwarding detail stays
encapsulated. Local host:5300 behavior is unchanged.
Problem
In Codespaces, creating an employee fails:
Root cause
ApiConfigService built the API base URL as ${window.location.hostname}:5300. In Codespaces the client host is …-4200.app.github.dev, so this produced …-4200.app.github.dev:5300. Codespaces doesn't expose ports as :port on the same host — each forwarded port is a separate subdomain (…-5300.app.github.dev) served over 443. The host:5300 URL therefore resolves to nothing.
Fix
When the host ends with .app.github.dev, swap the port segment (-4200 → -5300) and use the default (443) port; keep ${hostname}:5300 for local development.
Verification