feat: upload file

This commit is contained in:
cv
2021-05-27 23:00:32 +02:00
parent f887817a68
commit e891e7a538
8 changed files with 272 additions and 12 deletions
+14
View File
@@ -15,3 +15,17 @@ export const downloadEvents = async () => {
link.click();
});
};
export const uploadEvents = async (file) => {
console.log('uploading', file);
const formData = new FormData();
formData.append('jsondb', file); // appending file
await axios
.post(ontimeURL + '/db', formData, {
headers: {
'Content-Type': 'multipart/form-data',
},
})
.then((res) => console.log(res.data))
.catch((err) => console.error(err));
};