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
+1
View File
@@ -10,3 +10,4 @@ export const serverURL = calculateServer();
export const eventURL = serverURL + EVENT_TABLE;
export const eventsURL = serverURL + EVENTS_TABLE;
export const playbackURL = serverURL + 'playback';
export const ontimeURL = serverURL + 'ontime';
-15
View File
@@ -1,21 +1,6 @@
import axios from 'axios';
import { eventsURL } from '../api/apiConstants';
export const downloadEvents = async () => {
await axios({
url: eventsURL + '/download',
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();
});
};
export const fetchAllEvents = async () => {
const res = await axios.get(eventsURL);
return res.data;
+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();
});
};