Fix doubled /api/v1/api/v1 URL prefix in reports, budgets, investments
The axios client already has baseURL="/api/v1" so API calls must use short paths (/reports/..., /budgets, /investments/...) not the full /api/v1/... prefix. This was causing all report, budget, and investment requests to 404. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
dd66b2d5fe
commit
eaea2c6ce9
3 changed files with 18 additions and 18 deletions
|
|
@ -46,20 +46,20 @@ export interface BudgetCreate {
|
|||
}
|
||||
|
||||
export async function getBudgets(activeOnly = true): Promise<Budget[]> {
|
||||
const r = await api.get("/api/v1/budgets", { params: { active_only: activeOnly } });
|
||||
const r = await api.get("/budgets", { params: { active_only: activeOnly } });
|
||||
return r.data;
|
||||
}
|
||||
|
||||
export async function getBudgetSummary(): Promise<BudgetSummaryItem[]> {
|
||||
const r = await api.get("/api/v1/budgets/summary");
|
||||
const r = await api.get("/budgets/summary");
|
||||
return r.data;
|
||||
}
|
||||
|
||||
export async function createBudget(data: BudgetCreate): Promise<Budget> {
|
||||
const r = await api.post("/api/v1/budgets", data);
|
||||
const r = await api.post("/budgets", data);
|
||||
return r.data;
|
||||
}
|
||||
|
||||
export async function deleteBudget(id: string): Promise<void> {
|
||||
await api.delete(`/api/v1/budgets/${id}`);
|
||||
await api.delete(`/budgets/${id}`);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -62,17 +62,17 @@ export interface PricePoint {
|
|||
}
|
||||
|
||||
export async function getPortfolio(): Promise<PortfolioSummary> {
|
||||
const r = await api.get("/api/v1/investments/portfolio");
|
||||
const r = await api.get("/investments/portfolio");
|
||||
return r.data;
|
||||
}
|
||||
|
||||
export async function searchAssets(q: string): Promise<AssetSearchResult[]> {
|
||||
const r = await api.get("/api/v1/assets/search", { params: { q } });
|
||||
const r = await api.get("/assets/search", { params: { q } });
|
||||
return r.data;
|
||||
}
|
||||
|
||||
export async function getPriceHistory(assetId: string, days = 365): Promise<PricePoint[]> {
|
||||
const r = await api.get(`/api/v1/assets/${assetId}/prices`, { params: { days } });
|
||||
const r = await api.get(`/assets/${assetId}/prices`, { params: { days } });
|
||||
return r.data;
|
||||
}
|
||||
|
||||
|
|
@ -83,12 +83,12 @@ export async function createHolding(data: {
|
|||
avg_cost_basis: number;
|
||||
currency?: string;
|
||||
}): Promise<HoldingResponse> {
|
||||
const r = await api.post("/api/v1/investments/holdings", data);
|
||||
const r = await api.post("/investments/holdings", data);
|
||||
return r.data;
|
||||
}
|
||||
|
||||
export async function deleteHolding(id: string): Promise<void> {
|
||||
await api.delete(`/api/v1/investments/holdings/${id}`);
|
||||
await api.delete(`/investments/holdings/${id}`);
|
||||
}
|
||||
|
||||
export async function addInvestmentTransaction(data: {
|
||||
|
|
@ -101,11 +101,11 @@ export async function addInvestmentTransaction(data: {
|
|||
date: string;
|
||||
notes?: string;
|
||||
}): Promise<InvestmentTxn> {
|
||||
const r = await api.post("/api/v1/investments/transactions", data);
|
||||
const r = await api.post("/investments/transactions", data);
|
||||
return r.data;
|
||||
}
|
||||
|
||||
export async function getHoldingTransactions(holdingId: string): Promise<InvestmentTxn[]> {
|
||||
const r = await api.get(`/api/v1/investments/holdings/${holdingId}/transactions`);
|
||||
const r = await api.get(`/investments/holdings/${holdingId}/transactions`);
|
||||
return r.data;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -85,17 +85,17 @@ export interface SpendingTrendsReport {
|
|||
}
|
||||
|
||||
export async function getNetWorthReport(months = 12): Promise<NetWorthReport> {
|
||||
const r = await api.get("/api/v1/reports/net-worth", { params: { months } });
|
||||
const r = await api.get("/reports/net-worth", { params: { months } });
|
||||
return r.data;
|
||||
}
|
||||
|
||||
export async function getIncomeExpenseReport(months = 12): Promise<IncomeExpenseReport> {
|
||||
const r = await api.get("/api/v1/reports/income-vs-expense", { params: { months } });
|
||||
const r = await api.get("/reports/income-vs-expense", { params: { months } });
|
||||
return r.data;
|
||||
}
|
||||
|
||||
export async function getCashFlowReport(dateFrom?: string, dateTo?: string): Promise<CashFlowReport> {
|
||||
const r = await api.get("/api/v1/reports/cash-flow", {
|
||||
const r = await api.get("/reports/cash-flow", {
|
||||
params: { date_from: dateFrom, date_to: dateTo },
|
||||
});
|
||||
return r.data;
|
||||
|
|
@ -106,19 +106,19 @@ export async function getCategoryBreakdown(
|
|||
dateTo?: string,
|
||||
type = "expense"
|
||||
): Promise<CategoryBreakdownReport> {
|
||||
const r = await api.get("/api/v1/reports/category-breakdown", {
|
||||
const r = await api.get("/reports/category-breakdown", {
|
||||
params: { date_from: dateFrom, date_to: dateTo, type },
|
||||
});
|
||||
return r.data;
|
||||
}
|
||||
|
||||
export async function getBudgetVsActual(): Promise<BudgetVsActualReport> {
|
||||
const r = await api.get("/api/v1/reports/budget-vs-actual");
|
||||
const r = await api.get("/reports/budget-vs-actual");
|
||||
return r.data;
|
||||
}
|
||||
|
||||
export async function getSpendingTrends(months = 6): Promise<SpendingTrendsReport> {
|
||||
const r = await api.get("/api/v1/reports/spending-trends", { params: { months } });
|
||||
const r = await api.get("/reports/spending-trends", { params: { months } });
|
||||
return r.data;
|
||||
}
|
||||
|
||||
|
|
@ -147,6 +147,6 @@ export interface BalanceSheetReport {
|
|||
}
|
||||
|
||||
export async function getBalanceSheet(): Promise<BalanceSheetReport> {
|
||||
const r = await api.get("/api/v1/reports/balance-sheet");
|
||||
const r = await api.get("/reports/balance-sheet");
|
||||
return r.data;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue