import api from "src/api";

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

export const createMedia = async (formData) => {
  const { data } = await api.post("/unit-media", formData, {
    headers: { "Content-Type": "multipart/form-data" },
  });
  return data.payload;
};

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