import axios, { AxiosError, type AxiosResponse } from "axios"; import type { User } from "~/classes/User"; export function login(user: User, onSuccess: (token: string) => void, onError: (code?: string) => void) { axios.post(ApiConfig.getHttpBase() + '/login', user) .then((response) => { onSuccess(response.data); }) .catch((error: AxiosError) => { onError(error.response?.data); }); }