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