Files
prowler/ui/lib/integrations/test-connection-result.ts
T

24 lines
609 B
TypeScript

import type {
IntegrationConnectionTaskResult,
IntegrationConnectionTestResponse,
} from "@/types/integrations";
export const evaluateIntegrationConnectionTask = (
result: IntegrationConnectionTaskResult | undefined,
): IntegrationConnectionTestResponse => {
const isSuccessful = result?.connected === true && result.error === null;
if (isSuccessful) {
return {
success: true,
message: "Connection test completed successfully.",
};
}
return {
success: false,
error: result?.error || "Connection test failed.",
failedChannelId: result?.channel ?? null,
};
};