Skip to content

The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:

474 B
Raw Blame
import type { Engine } from "metabase-types/api";

interface Options {
  instanceUrl: string;
  cookie: string;
}

export async function fetchEngines(
  options: Options,
): Promise<Record<string, Engine> | null> {
  const { instanceUrl, cookie } = options;

  const res = await fetch(`${instanceUrl}/api/setting/engines`, {
    method: "GET",
    headers: { "content-type": "application/json", cookie },
  });

  if (!res.ok) {
    return null;
  }

  return res.json();
}