import apiClient from "@/infrastructure/apiClient";
import apiPath from "@/infrastructure/apiPath";

export default {
  async uploadJobPostContentPicture(formData) {
    var result = await apiClient
      .post(apiPath.picture.uploadJobPostContentPicture, formData, {
        headers: {
          "Content-Type": "multipart/form-data",
        },
      })
      .then((r) => {
        console.log(r.data);
        return r.data;
      })
      .catch((e) => {
        console.log(e);
        return {};
      });
    return result;
  },

  async uploadJobPostThumbPicture(formData) {
    var result = await apiClient
      .post(apiPath.picture.uploadJobPostThumbPicture, formData, {
        headers: {
          "Content-Type": "multipart/form-data",
        },
      })
      .then((r) => {
        return r.data;
      })
      .catch((e) => {
        console.log(e);
        return {};
      });
    return result;
  },

  async uploadPostContentPicture(formData) {
    var result = await apiClient
      .post(apiPath.picture.uploadPostContentPicture, formData, {
        headers: {
          "Content-Type": "multipart/form-data",
        },
      })
      .then((r) => {
        console.log(r.data);
        return r.data;
      })
      .catch((e) => {
        console.log(e);
        return {};
      });
    return result;
  },
  async uploadPostThumbPicture(formData) {
    var result = await apiClient
      .post(apiPath.picture.uploadPostThumbPicture, formData, {
        headers: {
          "Content-Type": "multipart/form-data",
        },
      })
      .then((r) => {
        return r.data;
      })
      .catch((e) => {
        console.log(e);
        return {};
      });
    return result;
  },

  async uploadProductContentPicture(formData) {
    var result = await apiClient
      .post(apiPath.picture.uploadProductContentPicture, formData, {
        headers: {
          "Content-Type": "multipart/form-data",
        },
      })
      .then((r) => {
        console.log(r.data);
        return r.data;
      })
      .catch((e) => {
        console.log(e);
        return {};
      });
    return result;
  },
  async uploadProductThumbPicture(formData) {
    var result = await apiClient
      .post(apiPath.picture.uploadProductThumbPicture, formData, {
        headers: {
          "Content-Type": "multipart/form-data",
        },
      })
      .then((r) => {
        return r.data;
      })
      .catch((e) => {
        console.log(e);
        return {};
      });
    return result;
  },

  async uploadOrderPicture(formData) {
    var result = await apiClient
      .post(apiPath.picture.uploadOrderPicture, formData, {
        headers: {
          "Content-Type": "multipart/form-data",
        },
      })
      .then((r) => {
        return r.data;
      })
      .catch((e) => {
        console.log(e);
        return {};
      });
    return result;
  },
  async uploadTopicContentPicture(formData) {
    var result = await apiClient
      .post(apiPath.picture.uploadTopicContentPicture, formData, {
        headers: {
          "Content-Type": "multipart/form-data",
        },
      })
      .then((r) => {
        return r.data;
      })
      .catch((e) => {
        console.log(e);
        return {};
      });
    return result;
  },
};
