@netlify/config
Version:
Netlify config module
20 lines (19 loc) • 589 B
JavaScript
import fetch from 'node-fetch';
export const getAvailableIntegrations = async function ({ testOpts, offline, extensionApiBaseUrl, }) {
if (offline) {
return [];
}
const { host } = testOpts;
const baseUrl = new URL(host ? `http://${host}/` : extensionApiBaseUrl);
try {
const response = await fetch(`${baseUrl}integrations`);
if (response.ok) {
const integrations = (await response.json());
return Array.isArray(integrations) ? integrations : [];
}
return [];
}
catch {
return [];
}
};