initial commit for having a backup

This commit is contained in:
jenzur
2019-06-13 22:08:08 +02:00
parent f54c447eb6
commit 6e89398bee
189 changed files with 15766 additions and 4367 deletions
@@ -0,0 +1,43 @@
const URLleaderboard = "http://localhost:8080/racetimer_endpoints-1.0/api/timers/leaderboard";
const URLPlayer = "http://localhost:8080/racetimer_endpoints-1.0/api/timers/player/";
const URLPlayerMaps = "http://localhost:8080/racetimer_endpoints-1.0/api/timers/player/maps/";
const URLMaps = "http://localhost:8080/racetimer_endpoints-1.0/api/timers/map/";
function makeOptions(method, body) {
var opts = {
method: method,
headers: {
"Content-type": "application/json"
}
};
if (body) {
opts.body = JSON.stringify(body);
}
return opts;
}
function handleHttpErrors(res) {
if (!res.ok) {
return Promise.reject({ status: res.status, fullError: res.json() });
}
return res.json();
}
class DataFacade {
getLeaderBoard = () => {
return fetch(URLleaderboard).then(handleHttpErrors);
};
getPlayer = steamID => {
return fetch(URLPlayer + steamID).then(handleHttpErrors);
}
getPlayerTimes = steamID => {
return fetch(URLPlayerMaps + steamID).then(handleHttpErrors);
}
getMapTimes = (mapname, stage) => {
return fetch(URLMaps + mapname + "/" + stage).then(handleHttpErrors);
}
}
export default new DataFacade();