mirror of
https://github.com/prowler-cloud/prowler.git
synced 2026-10-04 02:04:06 +00:00
Co-authored-by: alejandrobailo <alejandrobailo94@gmail.com>
24 lines
609 B
TypeScript
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,
|
|
};
|
|
};
|