More skelton loader, add optional parameters to /locations and /events
This commit is contained in:
@@ -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)
|
||||
}
|
||||
@@ -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)
|
||||
}
|
||||
Reference in New Issue
Block a user