2025-02-04 15:18:59 +01:00

26 lines
691 B
TypeScript

import axios from "axios";
const backendUrl = "http://localhost:8080/"
// TODO: spawn a error modal
function defaultApiErrorHandler(err: String){
console.log(err)
}
function defaultApiSuccessHandler(response: () => void){
console.log(response)
}
/*
function callApi(endpoint: string, onSuccessHandler: () => void, onErrorHandler: (err: String) => void): void {
console.log("callApi: "+ endpoint)
axios.get(backendUrl + endpoint).then(
onSuccessHandler == null ? defaultApiSuccessHandler : onSuccessHandler
).catch(
(err) => {
onErrorHandler == null ? defaultApiErrorHandler(err): onErrorHandler(err);
}
)
}
export {callApi}
*/