diff --git a/software/src/data/api/eventApi.ts b/software/src/data/api/eventApi.ts
index c9852e4..1186715 100644
--- a/software/src/data/api/eventApi.ts
+++ b/software/src/data/api/eventApi.ts
@@ -7,5 +7,11 @@ export async function fetchEvents(city: string = "", genre: string = "") {
url += (city.length > 0) ? "city=" + city + "&" : ""
url += (genre.length > 0) ? "genre=" + genre : ""
+ return await axios.get(url)
+}
+
+export async function getTopEvents(nrOfEvents) {
+ let url = BASE_URL + "?sort=desc&count=" + nrOfEvents
+
return await axios.get(url)
}
\ No newline at end of file
diff --git a/software/src/data/api/locationApi.ts b/software/src/data/api/locationApi.ts
index e452e17..fa7186f 100644
--- a/software/src/data/api/locationApi.ts
+++ b/software/src/data/api/locationApi.ts
@@ -1,6 +1,6 @@
import axios from "axios"
-let BASE_URL = "http://localhost:3000/locations"
+const BASE_URL = "http://localhost:3000/locations"
export async function getAllLocations() {
return await axios.get(BASE_URL)
@@ -8,4 +8,10 @@ export async function getAllLocations() {
export async function getLocation(locationName: string) {
return await axios.get(BASE_URL + "/" + locationName)
+}
+
+export async function getTopLocations(nrOfLocations: number) {
+ let url = BASE_URL + "?sort=desc&count=" + nrOfLocations
+
+ return await axios.get(url)
}
\ No newline at end of file
diff --git a/software/src/pages/homePage/index.vue b/software/src/pages/homePage/index.vue
index 3254f36..c21ef4f 100644
--- a/software/src/pages/homePage/index.vue
+++ b/software/src/pages/homePage/index.vue
@@ -3,12 +3,33 @@ import { useConcertStore } from '@/data/stores/concertStore';
import highlightCarousel from './highlightCarousel.vue';
import sectionDivider from '@/components/sectionDivider.vue';
import cardWithTopImage from '@/components/cardWithTopImage.vue';
-import { calcRating, lowestTicketPrice } from '@/scripts/concertScripts';
+import { lowestTicketPrice } from '@/scripts/concertScripts';
import OutlinedButton from '@/components/outlinedButton.vue';
import { useRouter } from 'vue-router';
+import { useFeedbackStore } from '@/data/stores/feedbackStore';
+import { ref } from 'vue';
+import { EventModel } from '@/data/models/acts/eventModel';
+import { getTopEvents } from '@/data/api/eventApi';
+import { LocationModel } from '@/data/models/locations/locationModel';
+import { getTopLocations } from '@/data/api/locationApi';
const router = useRouter()
-const concertStore = useConcertStore()
+const feedbackStore = useFeedbackStore()
+const topEvents = ref
>(Array.from({length: 4}, () => new EventModel()))
+const topLocations = ref>(Array.from({length: 8}, () => new LocationModel()))
+
+feedbackStore.fetchDataFromServerInProgress = true
+
+getTopEvents(4)
+ .then(events => {
+ topEvents.value = events.data
+
+ getTopLocations(8)
+ .then(locations => {
+ topLocations.value = locations.data
+ feedbackStore.fetchDataFromServerInProgress = false
+ })
+ })
@@ -28,12 +49,13 @@ const concertStore = useConcertStore()
- ab {{ lowestTicketPrice(concertStore.tours[i - 1]) }} €
+ ab {{ lowestTicketPrice(topEvents[i - 1]) }} €
@@ -59,12 +81,13 @@ const concertStore = useConcertStore()
- {{ concertStore.locations[i + 2].city.name }}, {{ concertStore.locations[i + 2].city.country }}
+ {{ topLocations[i - 1].city.name }}, {{ topLocations[i - 1].city.country }}