More skelton loader, add optional parameters to /locations and /events

This commit is contained in:
2024-10-04 15:20:40 +02:00
parent e2f6fb9c52
commit bfffd72a4a
16 changed files with 106 additions and 48 deletions

View File

@@ -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)
}

View File

@@ -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)
}