forked from innovacion/Mayacontigo
ic
This commit is contained in:
16
apps/Test/gui/utils/request.ts
Normal file
16
apps/Test/gui/utils/request.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
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());
|
||||
}
|
||||
Reference in New Issue
Block a user