Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | 1x 1x 1x 1x 1x 1x 1x 1x 2x 2x 1x 1x 1x 1x 1x 1x 1x 1x 1x | import client from './client'
export const financeApi = {
// Categories
listCategories: async () => {
const res = await client.get('finance/categories')
return res.data
},
createCategory: async (data) => {
const res = await client.post('finance/categories', data)
return res.data
},
updateCategory: async (id, data) => {
const res = await client.put(`finance/categories/${id}`, data)
return res.data
},
deleteCategory: async (id) => {
await client.delete(`finance/categories/${id}`)
},
// Transactions
listTransactions: async (params = {}) => {
const res = await client.get('finance/transactions', { params })
return res.data
},
createTransaction: async (data) => {
const res = await client.post('finance/transactions', data)
return res.data
},
updateTransaction: async (id, data) => {
const res = await client.put(`finance/transactions/${id}`, data)
return res.data
},
deleteTransaction: async (id) => {
await client.delete(`finance/transactions/${id}`)
},
// Summary & Analytics
getSummary: async (params = {}) => {
const res = await client.get('finance/summary', { params })
return res.data
},
getAnalytics: async (params = {}) => {
const res = await client.get('finance/analytics', { params })
return res.data
},
}
|