export async function httpQuery()

in src/graphql/base.ts [39:75]


export async function httpQuery({
  path = "",
  method = "GET",
  json,
  headers = {},
}: {
  path?: string;
  method: string;
  json: unknown;
  headers: Recordable;
}) {
  const timeoutId = setTimeout(() => {
    abortRequestsAndUpdate();
  }, Timeout);
  const url = `${BasePath}${path}`;
  const response: Response = await fetch(url, {
    method,
    headers: {
      "Content-Type": "application/json",
      accept: "application/json",
      ...headers,
    },
    body: JSON.stringify(json),
    signal: globalAbortController.signal,
  })
    .catch((error) => {
      throw new HTTPError(error);
    })
    .finally(() => {
      clearTimeout(timeoutId);
    });
  if (response.ok) {
    return response.json();
  } else {
    console.error(new HTTPError(response));
  }
}