feat: add popop with awfuls colors and backend api call

This commit is contained in:
Pierre Tellier
2025-02-08 12:11:20 +01:00
parent dfaa97346f
commit b228b78e17
7 changed files with 34 additions and 26 deletions

View File

@ -1,5 +1,6 @@
import axios from "axios";
import {store} from "@/main.ts";
import {addNewMessage, color} from "@/services/popupDisplayer.ts";
const axiosInstance = axios.create({
baseURL: import.meta.env.VITE_BACKEND_URL,
@ -34,11 +35,11 @@ axiosInstance.interceptors.response.use(
// TODO: spawn a error modal
function defaultApiErrorHandler(err: String){
console.log(err)
addNewMessage(err, color.Red);
}
function defaultApiSuccessHandler(response: () => void){
console.log(response)
addNewMessage(response.data, color.green)
}
function callApi(endpoint: string, onSuccessHandler?: any, onErrorHandler?: any): void {
axiosInstance.get(endpoint).then(