move api call, remove delete requested wine button, rename emit
This commit is contained in:
		| @@ -27,6 +27,12 @@ router.route("/request").get(async (req, res) => { | ||||
|   return res.send(rWines) | ||||
| }) | ||||
|  | ||||
| router.route("/request/all").get(async (req, res) => { | ||||
|   const allWines = await RequestedWine.find({}).populate("wine"); | ||||
|  | ||||
|   res.json(allWines); | ||||
| }); | ||||
|  | ||||
| router.route("/request").post(async (req, res) => { | ||||
|   const {wine} = req.body | ||||
|  | ||||
|   | ||||
| @@ -104,12 +104,6 @@ router.route("/highscore/statistics").get(async (req, res) => { | ||||
|   res.json(highscore); | ||||
| }); | ||||
|  | ||||
| router.route("/wines/all-requested-wines").get(async (req, res) => { | ||||
|   const allWines = await RequestedWine.find({}).populate("wine"); | ||||
|  | ||||
|   res.json(allWines); | ||||
| }); | ||||
|  | ||||
|  | ||||
| router.route("/wines/statistics").get(async (req, res) => { | ||||
|   const wines = await Wine.find(); | ||||
|   | ||||
| @@ -18,7 +18,7 @@ const convertToOurWineObject = wine => { | ||||
|       rating: wine.basic.alcoholContent, | ||||
|       occurences: 0, | ||||
|       id: wine.basic.productId, | ||||
|       image: `https://bilder.vinmonopolet.no/cache/300x300-0/${wine.basic.productId}-1.jpg`, | ||||
|       image: `https://bilder.vinmonopolet.no/cache/500x500-0/${wine.basic.productId}-1.jpg`, | ||||
|       price: wine.prices[0].salesPrice.toString(), | ||||
|       country: wine.origins.origin.country | ||||
|     } | ||||
|   | ||||
| @@ -25,7 +25,7 @@ const overallWineStatistics = () => { | ||||
| }; | ||||
|  | ||||
| const allRequestedWines = () => { | ||||
|   const url = new URL("/api/wines/all-requested-wines", BASE_URL); | ||||
|   const url = new URL("/api/request/all", BASE_URL); | ||||
|  | ||||
|   return fetch(url.href).then(resp => resp.json()); | ||||
| }; | ||||
|   | ||||
| @@ -7,7 +7,7 @@ | ||||
|       v-if="showModal"  | ||||
|       modalText="Ønsket ditt har blitt lagt til"  | ||||
|       :buttons="modalButtons" | ||||
|       @modalBtnClicked="emitFromModalButton" | ||||
|       @click="emitFromModalButton" | ||||
|     ></Modal> | ||||
|     <section> | ||||
|       <section class="search-section"> | ||||
|   | ||||
| @@ -38,7 +38,7 @@ export default { | ||||
|   }, | ||||
|   methods:{ | ||||
|     modalButtonClicked(action){ | ||||
|       this.$emit('modalBtnClicked', action) | ||||
|       this.$emit('click', action) | ||||
|     } | ||||
|   } | ||||
| } | ||||
|   | ||||
| @@ -19,9 +19,9 @@ | ||||
|           class="wine-link" | ||||
|         >Les mer på polet</a> | ||||
|         </section> | ||||
|         <button @click="deleteWine(wine)"> | ||||
|         <!-- <button @click="deleteWine(wine)"> | ||||
|           Slett vinen | ||||
|         </button> | ||||
|         </button> --> | ||||
|       </section> | ||||
|     </div> | ||||
| </template> | ||||
|   | ||||
		Reference in New Issue
	
	Block a user