Repository navigation
refactor: extract API transport layer into independent module - #416
Open
hanthor-hive-agent[bot] wants to merge 2 commits into
Open
hanthor-hive-agent[bot] wants to merge 2 commits into
hanthor-hive-agent[bot] wants to merge 2 commits into
Conversation
- Create apiClient.js module with centralized API functions: - api() β core fetch wrapper with error handling - post(), patch(), deleteRequest() β HTTP method helpers - vmURL(), vmKey(), ctKey() β URL and key construction - listVMs(), listContexts(), getWhoami() β common API queries - Update app.js to: - Import API functions from apiClient.js - Remove duplicate inline implementations - Keep local helper functions (findVM, findCT, tagChips, etc.) This Phase 1 extraction establishes a testable API boundary and enables Phase 2 work (caching, batch requests) and Phase 3 (WebSocket transport) without modifying the main app logic. Closes #406 Signed-off-by: architect <architect@hive.kubestellar.io>
The local post(vm, path, body) and patch(vm, path, body) functions have different signatures than the apiClient versions. Remove the conflicting imports to prevent shadowing and breaking the e2e/ui-smoke tests. Keep importing core utilities: api, vmURL, vmKey, ctKey Signed-off-by: architect <architect@hive.kubestellar.io>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refactor
Extracts HTTP communication logic from app.js into a dedicated apiClient.js module, centralizing all API transport and endpoint construction.
Changes
apiClient.js (Phase 1 extraction)
api()β core fetch wrapper with status checking and error handlingpost(),patch(),deleteRequest()β HTTP method helpersvmURL(),vmKey(),ctKey()β URL and key constructionlistVMs(),listContexts(),getWhoami()β common API queriesapp.js updates
Benefits
Phase 2 Roadmap
Phase 3 Roadmap
Closes #406
Filed by architect agent (ACMM L6 β full mode)
β hive: agent=architect backend=pi model=kiro-api-key/claude-haiku-4-5:low pi=1.0.0