Repository navigation
Labels
GrantFox OSSIssue tracked in GrantFox OSSIssue tracked in GrantFox OSSMaybe RewardedIssue may be eligible for a GrantFox rewardIssue may be eligible for a GrantFox rewardThird CampaignCampaign: Third CampaignCampaign: Third CampaignbugSomething isn't workingSomething isn't workingfrontendFrontend UIFrontend UIhelp wantedExtra attention is neededExtra attention is needed
Description
Problem
In frontend/src/hooks/usePortfolio.ts, both fetchPortfolio and executeRebalance call fetch() directly with relative paths like /api/portfolio/${portfolioId}. This bypasses:
- The centralized
API_CONFIG.BASE_URLfromfrontend/src/config/api.ts— needed for non-same-origin deployments (e.g., the production Render URL) - The
apiRequestwrapper's retry logic (3 attempts with exponential backoff) - The 15-second timeout via
AbortController
In production, if the API is on a different origin, the hook's calls silently fail or hit the wrong endpoint. This was partially addressed in issue #47 but the hook was not updated — only Dashboard.tsx and Landing.tsx use API_CONFIG.BASE_URL.
Proposed Fix
1. Use API_CONFIG.BASE_URL
Import API_CONFIG from ../config/api and prefix all fetch URLs:
const response = await fetch(`${API_CONFIG.BASE_URL}/api/portfolio/${portfolioId}`);2. Replace with apiRequest
Use the existing apiRequest wrapper for automatic retry, timeout, and error parsing:
import { apiRequest, API_CONFIG } from '../config/api';
const data = await apiRequest(`${API_CONFIG.BASE_URL}/api/portfolio/${portfolioId}`);3. Verify response parsing
apiRequest returns parsed JSON. The GET /portfolio/:id route returns { success: true, portfolio: {...} }, so make sure setPortfolio(data.portfolio) still works correctly.
Files to modify
frontend/src/hooks/usePortfolio.ts— updatefetchPortfolioandexecuteRebalance
Acceptance Criteria
- Import
API_CONFIGfrom../config/api - All fetch URLs prefixed with
API_CONFIG.BASE_URL - Replace direct
fetch()withapiRequestwrapper -
setPortfolio(data.portfolio)still works correctly with parsed JSON response - Hook works when
VITE_API_URLis set to a remote URL - Network errors show error state and retry per
apiRequestconfig
Affected Area
Frontend
Metadata
Metadata
Assignees
Labels
GrantFox OSSIssue tracked in GrantFox OSSIssue tracked in GrantFox OSSMaybe RewardedIssue may be eligible for a GrantFox rewardIssue may be eligible for a GrantFox rewardThird CampaignCampaign: Third CampaignCampaign: Third CampaignbugSomething isn't workingSomething isn't workingfrontendFrontend UIFrontend UIhelp wantedExtra attention is neededExtra attention is needed
Activity
waterWang commentedon Aug 22, 2026
I would like to work on this issue. Please assign it to me.
Neziahtech commentedon Aug 22, 2026
Hello,
I’d love to take this issue on. I’m a full-stack developer with experience across Drips Waves 3–7, and the GrantFox oficiall 1 and2 campaign.
My stack includes Rust, Soroban, Solidity, and TypeScript. I can deliver a clean, tested, and well-documented solution within 24 hours of assignment.
Happy to start immediately.
waterWang commentedon Aug 22, 2026
Submitted PR #69 for this issue: #69
Changes:
fetch()calls withapiRequestwrapperAPI_CONFIG.ENDPOINTS.PORTFOLIO_DETAILandENDPOINTS.PORTFOLIO_REBALANCEapiRequestprovides retry logic, timeout, andBASE_URLprefixingD240021 commentedon Aug 22, 2026
Hi! 👋
I’m currently a Computer Science student and I’m starting to get into the world of open source contributions. I’m very interested in this issue and would like to work on it to gain experience, build confidence, and expand my CV.
Could you please assign it to me? 🙂
Thank you! 🚀
waterWang commentedon Aug 23, 2026
I would like to work on this issue. Fixing usePortfolio to use centralized API config and retry/timeout logic.
Stanley-Owoh commentedon Aug 23, 2026
Good day maintainer, i would like to work on this issue. i will update
usePortfolioto useAPI_CONFIG.BASE_URLand theapiRequestwrapper for consistent retries, timeouts, error handling, and remote API support.TCROWN10 commentedon Aug 23, 2026
I would like to work on this issue. I’ve gone through the project and carefully reviewed the issue itself, and I believe it’s something I can handle effectively. I’m confident in my ability to work on it, give it my best, and get it completed successfully. I’m ready to take on the task and deliver a solid result.
grantfox-oss commentedon Aug 24, 2026
🦊 GrantFox — @TCROWN10 has been assigned to this issue as part of the Third Campaign campaign!
Next steps:
Closes #66)Good luck! Track your progress on GrantFox.
fix: route usePortfolio through apiRequest and API_CONFIG (#73)
grantfox-oss commentedon Aug 26, 2026
🎉 This issue has been marked as completed on GrantFox as part of the Third Campaign campaign!
@TCROWN10's PR #73 was approved and merged by @Uchechukwu-Ekezie.
🏆 @TCROWN10: You earned 35 FoxPoints for this contribution! Your current tier: Explorer (379 total points). Track your full progress on GrantFox.
👏 Great work, @TCROWN10! Keep contributing to grantFoxin.