Files
prowler/ui/actions/lighthouse/checks.ts
Chandrapal Badshah 74f7a86c2b feat(lighthouse): Add chat interface (#7878)
Co-authored-by: Chandrapal Badshah <12944530+Chan9390@users.noreply.github.com>
2025-06-12 15:19:41 +02:00

46 lines
1.0 KiB
TypeScript

export const getLighthouseProviderChecks = async ({
providerType,
service,
severity,
compliances,
}: {
providerType: string;
service: string[];
severity: string[];
compliances: string[];
}) => {
const url = new URL(
`https://hub.prowler.com/api/check?fields=id&providers=${providerType}`,
);
if (service) {
url.searchParams.append("services", service.join(","));
}
if (severity) {
url.searchParams.append("severities", severity.join(","));
}
if (compliances) {
url.searchParams.append("compliances", compliances.join(","));
}
const response = await fetch(url.toString(), {
method: "GET",
});
const data = await response.json();
const ids = data.map((item: { id: string }) => item.id);
return ids;
};
export const getLighthouseCheckDetails = async ({
checkId,
}: {
checkId: string;
}) => {
const url = new URL(`https://hub.prowler.com/api/check/${checkId}`);
const response = await fetch(url.toString(), {
method: "GET",
});
const data = await response.json();
return data;
};