Reflecting changes from renaming backend routes.
This commit is contained in:
		
							
								
								
									
										48
									
								
								src/api.js
									
									
									
									
									
								
							
							
						
						
									
										48
									
								
								src/api.js
									
									
									
									
									
								
							| @@ -42,8 +42,22 @@ const prelottery = () => { | ||||
|   return fetch(url.href).then(resp => resp.json()); | ||||
| }; | ||||
|  | ||||
| const log = sendObject => { | ||||
|   const url = new URL("/api/log", BASE_URL); | ||||
| const sendLottery = sendObject => { | ||||
|   const url = new URL("/api/lottery", BASE_URL); | ||||
|  | ||||
|   const options = { | ||||
|     headers: { | ||||
|       "Content-Type": "application/json" | ||||
|     }, | ||||
|     method: "POST", | ||||
|     body: JSON.stringify(sendObject) | ||||
|   }; | ||||
|  | ||||
|   return fetch(url.href, options).then(resp => resp.json()); | ||||
| }; | ||||
|  | ||||
| const sendLotteryWinners = sendObject => { | ||||
|   const url = new URL("/api/lottery/winners", BASE_URL); | ||||
|  | ||||
|   const options = { | ||||
|     headers: { | ||||
| @@ -57,7 +71,7 @@ const log = sendObject => { | ||||
| }; | ||||
|  | ||||
| const addAttendee = sendObject => { | ||||
|   const url = new URL("/api/virtual/attendee", BASE_URL); | ||||
|   const url = new URL("/api/virtual/attendee/add", BASE_URL); | ||||
|  | ||||
|   const options = { | ||||
|     headers: { | ||||
| @@ -71,31 +85,31 @@ const addAttendee = sendObject => { | ||||
| }; | ||||
|  | ||||
| const getVirtualWinner = () => { | ||||
|   const url = new URL("/api/virtual/winner", BASE_URL); | ||||
|   const url = new URL("/api/virtual/winner/draw", BASE_URL); | ||||
|  | ||||
|   return fetch(url.href).then(resp => resp.json()); | ||||
| }; | ||||
|  | ||||
| const attendeesSecure = () => { | ||||
|   const url = new URL("/api/virtual/attendees/secure", BASE_URL); | ||||
|   const url = new URL("/api/virtual/attendee/all/secure", BASE_URL); | ||||
|  | ||||
|   return fetch(url.href).then(resp => resp.json()); | ||||
| }; | ||||
|  | ||||
| const winnersSecure = () => { | ||||
|   const url = new URL("/api/virtual/winners/secure", BASE_URL); | ||||
|   const url = new URL("/api/virtual/winner/all/secure", BASE_URL); | ||||
|  | ||||
|   return fetch(url.href).then(resp => resp.json()); | ||||
| }; | ||||
|  | ||||
| const winners = () => { | ||||
|   const url = new URL("/api/virtual/winners", BASE_URL); | ||||
|   const url = new URL("/api/virtual/winner/all", BASE_URL); | ||||
|  | ||||
|   return fetch(url.href).then(resp => resp.json()); | ||||
| }; | ||||
|  | ||||
| const deleteWinners = () => { | ||||
|   const url = new URL("/api/virtual/winners", BASE_URL); | ||||
|   const url = new URL("/api/virtual/winner/all", BASE_URL); | ||||
|  | ||||
|   const options = { | ||||
|     headers: { | ||||
| @@ -108,7 +122,7 @@ const deleteWinners = () => { | ||||
| }; | ||||
|  | ||||
| const deleteAttendees = () => { | ||||
|   const url = new URL("/api/virtual/attendees", BASE_URL); | ||||
|   const url = new URL("/api/virtual/attendee/all", BASE_URL); | ||||
|  | ||||
|   const options = { | ||||
|     headers: { | ||||
| @@ -121,7 +135,7 @@ const deleteAttendees = () => { | ||||
| }; | ||||
|  | ||||
| const attendees = () => { | ||||
|   const url = new URL("/api/virtual/attendees", BASE_URL); | ||||
|   const url = new URL("/api/virtual/attendee/all", BASE_URL); | ||||
|  | ||||
|   return fetch(url.href).then(resp => resp.json()); | ||||
| }; | ||||
| @@ -141,7 +155,7 @@ const logWines = wines => { | ||||
| }; | ||||
|  | ||||
| const wineSchema = () => { | ||||
|   const url = new URL("/api/log/schema", BASE_URL); | ||||
|   const url = new URL("/api/wineinfo/schema", BASE_URL); | ||||
|  | ||||
|   return fetch(url.href).then(resp => resp.json()); | ||||
| }; | ||||
| @@ -217,17 +231,20 @@ const getChatHistory = (skip = null, take = null) => { | ||||
|  | ||||
| const finishedDraw = () => { | ||||
|   const url = new URL("/api/virtual/finish", BASE_URL); | ||||
|   const options = { | ||||
|     method: 'POST' | ||||
|   } | ||||
|  | ||||
|   return fetch(url.href).then(resp => resp.json()); | ||||
|   return fetch(url.href, options).then(resp => resp.json()); | ||||
| }; | ||||
|  | ||||
| const getAmIWinner = id => { | ||||
|   const url = new URL(`/api/virtual-registration/${id}`, BASE_URL); | ||||
|   const url = new URL(`/api/winner/${id}`, BASE_URL); | ||||
|   return fetch(url.href).then(resp => resp.json()); | ||||
| }; | ||||
|  | ||||
| const postWineChosen = (id, wineName) => { | ||||
|   const url = new URL(`/api/virtual-registration/${id}`, BASE_URL); | ||||
|   const url = new URL(`/api/winner/${id}`, BASE_URL); | ||||
|   const options = { | ||||
|     headers: { | ||||
|       "Content-Type": "application/json" | ||||
| @@ -265,7 +282,8 @@ export { | ||||
|   chartWinsByColor, | ||||
|   chartPurchaseByColor, | ||||
|   prelottery, | ||||
|   log, | ||||
|   sendLottery, | ||||
|   sendLotteryWinners, | ||||
|   logWines, | ||||
|   wineSchema, | ||||
|   barcodeToVinmonopolet, | ||||
|   | ||||
		Reference in New Issue
	
	Block a user