import api from "src/api";

export const getHistoriesByUnit = async (unitId) => {
  const { data } = await api.get("/unit-history", { params: { unit_id: unitId } });
  return data.payload;
};

export const createHistory = async (payload) => {
  const { data } = await api.post("/unit-history", payload);
  return data.payload;
};

export const updateHistory = async (id, payload) => {
  const { data } = await api.put(`/unit-history/${id}`, payload);
  return data.payload;
};

export const deleteHistory = async (id) => {
  const { data } = await api.delete(`/unit-history/${id}`);
  return data;
};
