|
|
@@ -86,54 +86,9 @@ export const fileDownload = ({url, fileId, skey, filename, onResponse, onError}) |
|
|
|
}); |
|
|
|
}; |
|
|
|
|
|
|
|
// export const reportDownload = ({url, onError}) =>{ |
|
|
|
// axios.get( url, |
|
|
|
// { |
|
|
|
// responseType: 'blob', |
|
|
|
// } |
|
|
|
// ).then( |
|
|
|
// (response)=>{ |
|
|
|
// const filename = response.headers |
|
|
|
// .get("content-disposition") |
|
|
|
// .split("filename=")[1] |
|
|
|
// .split('"')[1].trim(); |
|
|
|
// const url = URL.createObjectURL(response.data); |
|
|
|
// const a = document.createElement('a'); |
|
|
|
// a.href = url; |
|
|
|
// a.setAttribute("download", filename); |
|
|
|
// document.body.appendChild(a); |
|
|
|
// a.click(); |
|
|
|
// document.body.removeChild(a); |
|
|
|
// URL.revokeObjectURL(url); |
|
|
|
// } |
|
|
|
// ).catch(error => { |
|
|
|
// return handleError(error,onError); |
|
|
|
// }); |
|
|
|
// }; |
|
|
|
|
|
|
|
export const fileUpload = ({ refType, refId, files, refCode, onSuccess, onFail, onError}) =>{ |
|
|
|
// console.log(files); |
|
|
|
// var formData = new FormData(); |
|
|
|
// for (let i = 0; i < files.length; i++){ |
|
|
|
// const file = files[i] |
|
|
|
// formData.append("multipartFileList", file); |
|
|
|
// } |
|
|
|
// // formData.append("multipartFile", file); |
|
|
|
// formData.append("refType", refType); |
|
|
|
// formData.append("refId", refId); |
|
|
|
// if(refCode){ |
|
|
|
// formData.append("refCode", refCode); |
|
|
|
// } |
|
|
|
// console.log(formData) |
|
|
|
// axios.post(FILE_UP_POST,formData,{ |
|
|
|
// headers: { |
|
|
|
// "Content-Type":"multipart/form-data" |
|
|
|
// } |
|
|
|
// }).then( |
|
|
|
// (response)=>{ |
|
|
|
// onResponse(response,onSuccess,onFail); |
|
|
|
// } |
|
|
|
// ).catch(error => { return handleError(error, onError); }); |
|
|
|
|
|
|
|
export const fileUpload = ({refType, refId, files, refCode, onSuccess, onFail, onError}) =>{ |
|
|
|
postWithFiles({ |
|
|
|
url: FILE_UP_POST, |
|
|
|
params:{ |
|
|
|