Files
eventmaster/software/src/data/api/locationApi.ts
2024-10-12 21:00:42 +02:00

21 lines
572 B
TypeScript

import axios from "axios"
const BASE_URL = "http://localhost:3000/locations"
export async function fetchAllLocations() {
return await axios.get(BASE_URL)
}
export async function getLocation(locationName: string) {
return await axios.get(BASE_URL + "/location/" + locationName)
}
export async function fetchTopLocations(nrOfLocations: number) {
let url = BASE_URL + "?sort=desc&count=" + nrOfLocations
return await axios.get(url)
}
export async function searchLocation(searchTerm: string) {
return await axios.get(BASE_URL + "/search?value=" + searchTerm)
}