From 90eb557f0b14f7477c050011a92223d3b6a6aaf0 Mon Sep 17 00:00:00 2001 From: KevinMidboe Date: Sun, 11 Oct 2020 14:04:08 +0200 Subject: [PATCH] New api route for history by date. --- src/api.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/api.js b/src/api.js index 05145b9..e747b1f 100644 --- a/src/api.js +++ b/src/api.js @@ -333,6 +333,18 @@ const historyAll = () => { }); } +const historyByDate = (date) => { + const url = new URL(`/api/lottery/by-date/${ date }`, BASE_URL); + + return fetch(url.href).then(resp => { + if (resp.ok) { + return resp.json(); + } else { + return handleErrors(resp); + } + }); +} + export { statistics, colorStatistics, @@ -364,5 +376,6 @@ export { finishedDraw, getAmIWinner, postWineChosen, - historyAll + historyAll, + historyByDate };