Browse Source

Fix report image

pull/1/head
Wahyu Ramadhan 1 year ago
parent
commit
e2a8832121
  1. 7
      edit-mode/function/ganttConfig.js
  2. 13
      edit-mode/function/reportActivity.js

7
edit-mode/function/ganttConfig.js

@ -22,7 +22,12 @@ const axiosInstance = axios.create({
"Content-type": "application/json" "Content-type": "application/json"
} }
}); });
const axiosInstanceMultipart = axios.create({
headers: {
"Content-Type": "multipart/form-data",
"Authorization": `Bearer ${token}`,
}
});
axiosInstance.interceptors.request.use(async (config) => { axiosInstance.interceptors.request.use(async (config) => {
try { try {
$("body").addClass("loading"); $("body").addClass("loading");

13
edit-mode/function/reportActivity.js

@ -426,8 +426,19 @@ $(document).ready(function () {
.catch((error) => error.response); .catch((error) => error.response);
// console.log("cek result", result); // console.log("cek result", result);
let reportId = result.data.data.report_id;
let imageFormData = new FormData();
let image = formData.get("files");
imageFormData.append("ref_id",reportId);
imageFormData.append("category", "report_activity");
imageFormData.append("files", image, image.name);
const resultImage = await axiosInstanceMultipart
.post(`${base_url}image/upload`, imageFormData)
.then(res => res)
.catch((error) => error.response);
if (result && result.status == 200) { if (result && result.status == 200 && resultImage && resultImage.status == 200) {
gantt.alert("Add report activity material Success!"); gantt.alert("Add report activity material Success!");
resetFormAddRaMaterial(); resetFormAddRaMaterial();
tableRaMaterialActual.draw(); tableRaMaterialActual.draw();

Loading…
Cancel
Save