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());
}
