setup router + tidy up

This commit is contained in:
cv
2021-05-27 22:56:49 +02:00
parent b61a82627e
commit f887817a68
6 changed files with 36 additions and 23 deletions
+17
View File
@@ -0,0 +1,17 @@
import axios from 'axios';
import { ontimeURL } from './apiConstants';
export const downloadEvents = async () => {
await axios({
url: ontimeURL + '/db',
method: 'GET',
responseType: 'blob', // important
}).then((response) => {
const url = window.URL.createObjectURL(new Blob([response.data]));
const link = document.createElement('a');
link.href = url;
link.setAttribute('download', 'events.json');
document.body.appendChild(link);
link.click();
});
};