import http from "./common"; class UploadFilesService { // UPLOAD FILES EXAMPLE with FormData upload(file: any, onUploadProgress: any) { let formData = new FormData(); // ADD the file field for the upload file formData.append("file", file); // SEND post data and headers to /upload endpoint return http.post("/upload", formData, { headers: { "Content-Type": "multipart/form-data", }, onUploadProgress, }); } // get Method getFiles() { return http.get(`/files`); } // POST METHOD donwloadFile(postData: any, headers: any) { return http.post(`/download`, postData, headers); } getFilseDetails(postData: any) { return http.post(`/fileDetails`, postData); } updateFilseDetails(postData: any) { return http.post(`/putFileDetails`, postData); } } export default new UploadFilesService();