diff --git a/assets/APIService.ts b/assets/APIService.ts index eb899d3729eaf0542ebddb67b2b45840e59fd380..1e630043baea4646b37d14554cbc66a1983ee4f0 100644 --- a/assets/APIService.ts +++ b/assets/APIService.ts @@ -21,7 +21,7 @@ class APIService { } // returns a list of all transacations - async read(): Promise<Transaction[]> { + async list(): Promise<Transaction[]> { let response = await fetch('/api/transaction'); let result = await response.json() as Transaction[]; return result; @@ -38,11 +38,17 @@ class APIService { // delete a particular transaction async delete(id: number) { - let response = await fetch(`/api/transaction/${id}`, + await fetch(`/api/transaction/${id}`, { method: 'DELETE', }); } + + async get(id: number): Promise<Transaction> { + let response = await fetch(`/api/transaction/${id}`); + let result = await response.json() as Transaction; + return result; + } }