import axios, {AxiosRequestConfig} from "axios"; export const http = axios.create({ withCredentials: true, }); export async function getJson(url: string, config?: AxiosRequestConfig): Promise { const response = await http.get(url, config) return response.data } export async function getText(url: string, config?: AxiosRequestConfig): Promise { const response = await http.get(url, { ...config, responseType: "text", }) return response.data } export async function postJson(url: string, body: TRequest, config?: AxiosRequestConfig): Promise { const response = await http.post(url, body, config) return response.data } export async function postVoid(url: string, body?: TRequest, config?: AxiosRequestConfig): Promise { await http.post(url, body, config) }