export async function requestJson()

in ui/src/app/services/api-request.ts [8:21]


export async function requestJson(path: string): Promise<any> {
  // const url = new URL(path, environment.apiBaseUrl);
  const response = await fetch(`${environment.apiBaseUrl}${path}`);

  if (!response.ok) {
    throw new Error(`Request failed with status ${response.status}`);
  }

  if (!response.body) {
    throw new Error('Response body is empty');
  }

  return await response.json();
}