Add option to fetch all divisions
parent
4aafccc550
commit
75594a81a6
|
@ -16,8 +16,12 @@ export async function getGenders(sportID) {
|
|||
return gendersList;
|
||||
}
|
||||
|
||||
export async function getDivisions(sportID, gender) {
|
||||
const response = await fetch(`/data/divisions?sport=${+sportID}&gender=${gender}`);
|
||||
export async function getDivisions(sportID = undefined, gender = undefined) {
|
||||
let URL = '/data/divisions?';
|
||||
if(sportID) URL += `sport=${+sportID}&`;
|
||||
if(gender) URL += `gender=${gender}&`;
|
||||
|
||||
const response = await fetch(URL);
|
||||
const divisionsList = await response.json();
|
||||
return divisionsList;
|
||||
}
|
||||
|
|
Reference in New Issue