Helper func for lottery/by-name.

This commit is contained in:
2020-10-09 00:55:47 +02:00
committed by KevinMidboe
parent 4c02c81cc3
commit e87a59b1e6

View File

@@ -333,6 +333,19 @@ const historyAll = () => {
});
}
const getWinnerByName = (name) => {
const encodedName = encodeURIComponent(name)
const url = new URL(`/api/lottery/by-name/${name}`, BASE_URL);
return fetch(url.href).then(resp => {
if (resp.ok) {
return resp.json();
} else {
return handleErrors(resp);
}
})
}
export {
statistics,
colorStatistics,
@@ -364,5 +377,6 @@ export {
finishedDraw,
getAmIWinner,
postWineChosen,
historyAll
historyAll,
getWinnerByName
};