Files
Mayacontigo/apps/Test/gui/utils/request.ts
Rogelio 325f1ef439 ic
2025-10-13 18:16:25 +00:00

17 lines
392 B
TypeScript

export async function httpRequest(
method: string,
endpoint: string,
body: object | null,
) {
const url = "/api" + endpoint;
const data = {
method: method,
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify(body),
credentials: "include" as RequestCredentials,
};
return await fetch(url, data).then((response) => response.json());
}