fix: resolve 404 balances endpoint and currency formatting errors

- Add missing /api/v1/balances endpoint to backend
- Update frontend Account type to match backend AccountDetails model
- Add currency validation with EUR fallback in formatCurrency function
- Update AccountsOverview, TransactionsList, and Dashboard components
- Fix balance calculations to use balances array structure
- All pre-commit checks pass
This commit is contained in:
Elisiário Couto
2025-09-08 23:45:31 +01:00
committed by Elisiário Couto
parent 947342e196
commit 417b77539f
6 changed files with 149 additions and 69 deletions

View File

@@ -34,7 +34,11 @@ export default function Dashboard() {
{ name: 'Analytics', icon: BarChart3, id: 'analytics' as TabType },
];
const totalBalance = accounts?.reduce((sum, account) => sum + (account.balance || 0), 0) || 0;
const totalBalance = accounts?.reduce((sum, account) => {
// Get the first available balance from the balances array
const primaryBalance = account.balances?.[0]?.amount || 0;
return sum + primaryBalance;
}, 0) || 0;
return (
<div className="flex h-screen bg-gray-100">