[Bug] Duplicate fetch/API client logic between api/client.ts and utils/api.ts #6
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?
Problem
The frontend has two separate API client implementations with overlapping functionality:
frontend/src/api/client.ts(324 lines) — Class-basedApiClientwithapiClientinstance, exportsauthApi,characterApi,campaignApi,shipApi,mcpClientfrontend/src/utils/api.ts(140 lines) — Function-basedbaseFetch/authFetchwith its owncharacterApi,authApi,campaignApi,shipApiexportsNeither imports from the other. The Zustand stores (
characterStore.ts,shipStore.ts,campaignStore.ts) import from@/api/client, butuseAuth.ts:69-70anduseAuthStoreinline their ownfetch()calls. This creates:Proposed fix
Consolidate to a single API client. Recommend keeping
api/client.ts(it's more complete and is what the stores already import from), and either:utils/api.tsentirely and migrateuseAuth.ts/useAuthStoreto useapi/client.tsPriority: Medium
Labels: refactor, frontend, cleanup
✅ Resolved by #39 (commit
05b5453) —utils/api.tsdeleted;api/client.tsis now the single API layer. Closing.