Add 12 ADRs documenting frontend architecture decisions

This commit is contained in:
2026-04-26 16:34:34 +02:00
parent c575992d64
commit 8f2632f456
13 changed files with 302 additions and 0 deletions
@@ -0,0 +1,29 @@
# ADR 0004: HTTP Interceptors Pipeline
**Date:** 2026-04-26
**Status:** Accepted
## Context
Every API call requires the same three cross-cutting concerns:
1. Prepend the API base URL so services don't hard-code it.
2. Attach the JWT bearer token when one exists.
3. Unwrap error responses into a consistent shape.
Handling these ad hoc in each service would duplicate logic and couple services to environment details.
## Decision
Three functional interceptors are chained in order in `app.config.ts`:
1. **`apiInterceptor`** — prepends `environment.apiBaseUrl` to every outgoing request URL. Consequence: all services call relative paths (e.g. `/skydive/jumps`), never absolute URLs.
2. **`tokenInterceptor`** — attaches `Authorization: Token <jwt>` when a token exists in `JwtService`.
3. **`errorInterceptor`** — unwraps `err.error` from HttpErrorResponse and rethrows, so subscribers receive the API error payload directly.
## Consequences
- **Positive:** Services are environment-agnostic. Swapping the API base URL requires changing only `environment.ts`.
- **Positive:** Auth header injection is transparent to all services.
- **Positive:** Error handling is uniform across the application.
- **Constraint:** Services must always use relative paths starting with `/`. Absolute URLs would get the base URL prepended, breaking them.