New api route for history by date.
This commit is contained in:
		
							
								
								
									
										15
									
								
								src/api.js
									
									
									
									
									
								
							
							
						
						
									
										15
									
								
								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 { | export { | ||||||
|   statistics, |   statistics, | ||||||
|   colorStatistics, |   colorStatistics, | ||||||
| @@ -364,5 +376,6 @@ export { | |||||||
|   finishedDraw, |   finishedDraw, | ||||||
|   getAmIWinner, |   getAmIWinner, | ||||||
|   postWineChosen, |   postWineChosen, | ||||||
|   historyAll |   historyAll, | ||||||
|  |   historyByDate | ||||||
| }; | }; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user