Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions app/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import NotFound from "./pages/NotFound";
import { Landing } from "./pages/Landing";
import ProtectedRoute from "./components/auth/ProtectedRoute";
import Account from "./pages/Account";
import { Accounts } from "./pages/Accounts";

const queryClient = new QueryClient({
defaultOptions: {
Expand Down Expand Up @@ -83,6 +84,14 @@ const App = () => (
</ProtectedRoute>
}
/>
<Route
path="accounts"
element={
<ProtectedRoute>
<Accounts />
</ProtectedRoute>
}
/>
<Route
path="account"
element={
Expand Down
45 changes: 45 additions & 0 deletions app/src/api/accounts.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import { api } from './client';

export type AccountType = 'CURRENT' | 'SAVINGS' | 'CREDIT' | 'INVESTMENT';

export type Account = {
id: number;
user_id: number;
name: string;
type: AccountType;
balance: number;
currency: string;
is_default: boolean;
created_at: string;
};

export type AccountCreate = {
name: string;
type: AccountType;
balance?: number;
currency?: string;
is_default?: boolean;
};

export type AccountsOverview = {
total_balance: number;
currency: string;
accounts_count: number;
allocation: Array<{
type: AccountType;
balance: number;
share_pct: number;
}>;
};

export async function getAccounts(): Promise<Account[]> {
return api<Account[]>('/accounts');
}

export async function createAccount(payload: AccountCreate): Promise<Account> {
return api<Account>('/accounts', { method: 'POST', body: payload });
}

export async function getAccountsOverview(): Promise<AccountsOverview> {
return api<AccountsOverview>('/accounts/overview');
}
1 change: 1 addition & 0 deletions app/src/components/layout/Navbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const navigation = [
{ name: 'Reminders', href: '/reminders' },
{ name: 'Expenses', href: '/expenses' },
{ name: 'Analytics', href: '/analytics' },
{ name: 'Accounts', href: '/accounts' },
];

export function Navbar() {
Expand Down
Loading