Add presets and endpoints data services

This commit is contained in:
Daniel D Orlando 2023-04-05 08:47:18 -07:00
parent f2d18c81fc
commit 3d0bfaef51
5 changed files with 102 additions and 126 deletions

View file

@ -1,13 +1,12 @@
import axios, { AxiosRequestConfig } from "axios";
async function _get<T>(url: string, options?: AxiosRequestConfig): Promise<T> {
const response = await axios.get(url, {...options});
const response = await axios.get(url, { withCredentials: true, ...options});
return response.data;
}
async function _post(url: string, arg?: any) {
const modifiedData = {arg, withCredentials: true}
const response = await axios.post(url, modifiedData, {
async function _post(url: string, data?: any) {
const response = await axios.post(url, JSON.stringify(data), {
headers: { "Content-Type": "application/json" },
});
return response.data;