DUP-TS-5: URLSearchParams builder pattern repeated 7 times in api.ts #50
Labels
No labels
backend
bug
chore
duplication
effort:complex
effort:medium
effort:trivial
enhancement
frontend
fullstack
priority:high
ready-for-agent
refactor
security
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
dries/ocman#50
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Seven API methods in
frontend/src/lib/api.tsrepeat the same ~6-line pattern for building query strings:metrics,sessions,sessionsNotify,activity,models,hourly,hourlyTokens.Duplicated pattern
Fix
Extract a helper
buildQueryString(params: Record<string, unknown>): stringthat filters nullish values and handles the? +prefix. All seven callers become a singlefetchJSONcall.Effort
Trivial.