This repository has been archived on 2024-04-05. You can view files and clone it, but cannot push or open issues/pull-requests.
score-tracker/public/scripts/data.js

29 lines
904 B
JavaScript

export async function getSports() {
const response = await fetch('/data/sports');
const sportsList = await response.json();
return sportsList;
}
export async function getSeasons() {
const response = await fetch('/data/seasons');
const seasonsList = await response.json();
return seasonsList;
}
export async function getGenders(sportID) {
const response = await fetch(`/data/genders?sport=${+sportID}`);
const gendersList = await response.json();
return gendersList;
}
export async function getDivisions(sportID, gender) {
const response = await fetch(`/data/divisions?sport=${+sportID}&gender=${gender}`);
const divisionsList = await response.json();
return divisionsList;
}
export async function getTeams(sportID) {
const response = await fetch(`/data/teams?sport=${+sportID}`);
const teamsList = await response.json();
return teamsList;
}