Changeset 62bba0c for src/main/resources/static/Wishlist.html
- Timestamp:
- 02/23/25 20:37:56 (3 months ago)
- Branches:
- master
- Children:
- fda671c
- Parents:
- de83113
- git-author:
- ste08 <sjovanoska@…> (02/23/25 20:37:23)
- git-committer:
- ste08 <sjovanoska@…> (02/23/25 20:37:56)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/main/resources/static/Wishlist.html
rde83113 r62bba0c 4 4 <meta charset="UTF-8"> 5 5 <meta name="viewport" content="width=device-width, initial-scale=1.0"> 6 <title>SkyChase-mk</title> 6 <script src="https://cdn.jsdelivr.net/npm/vue@2.6.14/dist/vue.js"></script> 7 <script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script> 8 <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.min.css"> 9 <link rel='stylesheet' href='https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.0-2/css/all.min.css'> 10 11 <title>SkyChase - Wishlist</title> 7 12 <style> 8 13 body { … … 24 29 display: flex; 25 30 align-items: center; 26 background-color: rebeccapurple;31 background-color: rebeccapurple; 27 32 padding: 10px; 28 33 width: 100%; … … 73 78 background-color: #0056b3; 74 79 } 80 75 81 .adminlogin { 76 top: 0;82 top: 0; 77 83 right: 0; 78 84 background-color: rebeccapurple; 79 border: 0;80 color: white;85 border: 0; 86 color: white; 81 87 padding: 0 1200px; 88 } 89 90 .wishlist-content { 91 margin-top: 60px; 92 color: white; 93 } 94 95 ul { 96 list-style-type: none; 97 } 98 99 li { 100 margin: 10px 0; 101 font-size: 18px; 82 102 } 83 103 </style> … … 90 110 </div> 91 111 92 <div class="buttons"> 93 <h1>Test</h1> 112 <div class="wishlist-content"> 113 <h1>Your Wishlist</h1> 114 <ul> 115 <li v-if="wishlist.length === 0">Your wishlist is empty!</li> 116 <li v-else v-for="item in wishlist" :key="item.wishlistID">{{ item.targetId }} || {{item.userId}}</li> 117 </ul> 94 118 </div> 119 120 <script src="https://cdn.jsdelivr.net/npm/vue@2.6.14/dist/vue.js"></script> 121 122 <script> 123 new Vue({ 124 el: '#app', 125 data: { 126 userId: '' 127 }, 128 mounted() { 129 const params = new URLSearchParams(window.location.search); 130 this.userId = params.get("userId"); 131 this.fetchWishlist(); 132 }, 133 async fetchWishlist() { 134 try { 135 const response = await fetch(`/api/wishlists/${this.userId}`); 136 const wishlist = await response.json(); 137 138 const wishlistElement = document.getElementById('wishlist'); 139 const emptyMessage = document.getElementById('empty-message'); 140 141 if (wishlist.length === 0) { 142 emptyMessage.style.display = 'block'; 143 } else { 144 emptyMessage.style.display = 'none'; 145 wishlistElement.innerHTML = wishlist.map(item => `<li>${item.name}</li>`).join(''); 146 } 147 } catch (error) { 148 console.error('Error fetching wishlist:', error); 149 } 150 } 151 }) 152 //window.onload = fetchWishlist; 153 </script> 95 154 </body> 96 155 </html>
Note:
See TracChangeset
for help on using the changeset viewer.