Problem: Route has canActivate: [] (anonymous accessible) but the API endpoint requires [Authorize]. Anonymous users get a vague failed-load. The component's catch { } block also hides 401 vs 404 vs network errors.
Fix:
Add an AuthGuard (or matching pattern used elsewhere) on the route
Differentiate error types in the component's catch block: show login prompt for 401, not-found for 404, generic network error otherwise
Acceptance criteria:
Anonymous users see login prompt, not silent failure
Authenticated users get full functionality
Error states are distinguishable in UI
**Severity:** Medium (UX)
**Files:**
- `spikersoft-angular/projects/spikersoft/src/routes.ts` (domain-detail route)
- `spikersoft-angular/projects/spikersoft/src/app/_components/learning/domain-detail/domain-detail.component.ts` (~86-91)
**Problem:** Route has `canActivate: []` (anonymous accessible) but the API endpoint requires `[Authorize]`. Anonymous users get a vague failed-load. The component's `catch { }` block also hides 401 vs 404 vs network errors.
**Fix:**
- Add an `AuthGuard` (or matching pattern used elsewhere) on the route
- Differentiate error types in the component's catch block: show login prompt for 401, not-found for 404, generic network error otherwise
**Acceptance criteria:**
- [ ] Anonymous users see login prompt, not silent failure
- [ ] Authenticated users get full functionality
- [ ] Error states are distinguishable in UI
**Resolved.**
Applied two changes:
1. `routes.ts` -- the `tree-of-knowledge/domain/:domainKey` route now uses `canActivate: [AuthGuard]` to match the `[Authorize]` API endpoint.
2. `domain-detail.component.ts` -- replaced the silent `catch {}` with `describeLoadError(err: unknown)` which differentiates `HttpErrorResponse` statuses 0 (network), 401 (sign in), 403 (unauthorized), 404 (not found), and other (`Failed to load domain detail (NNN)`).
Files changed:
- `spikersoft-angular/projects/spikersoft/src/routes.ts`
- `spikersoft-angular/projects/spikersoft/src/app/_components/learning/domain-detail/domain-detail.component.ts`
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Severity: Medium (UX)
Files:
spikersoft-angular/projects/spikersoft/src/routes.ts(domain-detail route)spikersoft-angular/projects/spikersoft/src/app/_components/learning/domain-detail/domain-detail.component.ts(~86-91)Problem: Route has
canActivate: [](anonymous accessible) but the API endpoint requires[Authorize]. Anonymous users get a vague failed-load. The component'scatch { }block also hides 401 vs 404 vs network errors.Fix:
AuthGuard(or matching pattern used elsewhere) on the routeAcceptance criteria:
Resolved.
Applied two changes:
routes.ts-- thetree-of-knowledge/domain/:domainKeyroute now usescanActivate: [AuthGuard]to match the[Authorize]API endpoint.domain-detail.component.ts-- replaced the silentcatch {}withdescribeLoadError(err: unknown)which differentiatesHttpErrorResponsestatuses 0 (network), 401 (sign in), 403 (unauthorized), 404 (not found), and other (Failed to load domain detail (NNN)).Files changed:
spikersoft-angular/projects/spikersoft/src/routes.tsspikersoft-angular/projects/spikersoft/src/app/_components/learning/domain-detail/domain-detail.component.ts