import api from './api'

export async function createTransaction(payload) {
  const res = await api.post('/api/transactions', payload)
  return res.data
}

export async function getAllTransactions() {
  const res = await api.get('/api/transactions')
  return res.data
}


export async function getTransactionById(id) {
  const res = await api.get(`/api/transactions/${id}`)
  return res.data
}

export async function updateTransaction(id, payload) {
  const res = await api.put(`/api/transactions/${id}`, payload)
  return res.data
}

export async function deleteTransaction(id) {
  const res = await api.delete(`/api/transactions/${id}`)
  return res.data
}

