feat: add popop with awfuls colors and backend api call
This commit is contained in:
@ -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(
|
||||
|
Reference in New Issue
Block a user