Header, Footer, FileUpload
This commit is contained in:
27
src/services/FileUploadService.ts
Normal file
27
src/services/FileUploadService.ts
Normal file
@ -0,0 +1,27 @@
|
||||
//import http from "../http-common";
|
||||
|
||||
import { Axios } from '../context/UserContext';
|
||||
|
||||
const upload = (file: File, onUploadProgress: any): Promise<any> => {
|
||||
let formData = new FormData();
|
||||
|
||||
formData.append("file", file);
|
||||
|
||||
return Axios.post("/upload", formData, {
|
||||
headers: {
|
||||
"Content-Type": "multipart/form-data",
|
||||
},
|
||||
onUploadProgress,
|
||||
});
|
||||
};
|
||||
|
||||
const getFiles = () : Promise<any> => {
|
||||
return Axios.get("/files");
|
||||
};
|
||||
|
||||
const FileUploadService = {
|
||||
upload,
|
||||
getFiles,
|
||||
};
|
||||
|
||||
export default FileUploadService;
|
||||
Reference in New Issue
Block a user