feat(frontend): Added options for modifying and deleting transactions in the UI

This commit is contained in:
ribardej
2025-11-05 18:00:24 +01:00
parent 8543c72730
commit 36b1fe887b
2 changed files with 124 additions and 21 deletions

View File

@@ -19,6 +19,17 @@ export type Transaction = {
date?: string | null; // ISO date (YYYY-MM-DD)
};
export async function deleteTransaction(id: number): Promise<void> {
const res = await fetch(`${getBaseUrl()}/transactions/${id}/delete`, {
method: 'DELETE',
headers: getHeaders('none'),
});
if (!res.ok) {
const text = await res.text();
throw new Error(text || 'Failed to delete transaction');
}
}
function getBaseUrl() {
const base = BACKEND_URL?.replace(/\/$/, '') || '';
return base || '';