From 3609043e4ce6914f25ba86d3784bbe108fd533d2 Mon Sep 17 00:00:00 2001 From: Pablo Lara Date: Mon, 4 Nov 2024 12:53:55 +0100 Subject: [PATCH] chore: remove connected param in the last step --- .github/pull_request_template.md | 4 ---- .../providers/(set-up-provider)/launch-scan/page.tsx | 5 ++--- components/providers/workflow/forms/launch-scan-form.tsx | 7 ++++--- .../providers/workflow/forms/test-connection-form.tsx | 2 +- 4 files changed, 7 insertions(+), 11 deletions(-) diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 3e463cfe60..4bf3030402 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -1,7 +1,3 @@ -### Motivation - -Why it this PR useful for the project? - ### Description What was done in this PR diff --git a/app/(prowler)/providers/(set-up-provider)/launch-scan/page.tsx b/app/(prowler)/providers/(set-up-provider)/launch-scan/page.tsx index 0fd9edb08c..3e88a5ea46 100644 --- a/app/(prowler)/providers/(set-up-provider)/launch-scan/page.tsx +++ b/app/(prowler)/providers/(set-up-provider)/launch-scan/page.tsx @@ -5,12 +5,11 @@ import { getProvider } from "@/actions/providers"; import { LaunchScanForm } from "@/components/providers/workflow/forms"; interface Props { - searchParams: { type: string; id: string; connected: boolean }; + searchParams: { type: string; id: string }; } export default async function LaunchScanPage({ searchParams }: Props) { const providerId = searchParams.id; - const connectedSearchParam = searchParams.connected; if (!providerId) { redirect("/providers/connect-account"); @@ -23,7 +22,7 @@ export default async function LaunchScanPage({ searchParams }: Props) { const isConnected = providerData?.data?.attributes?.connection?.connected; - if (!isConnected || connectedSearchParam !== isConnected.toString()) { + if (!isConnected) { redirect("/providers/connect-account"); } diff --git a/components/providers/workflow/forms/launch-scan-form.tsx b/components/providers/workflow/forms/launch-scan-form.tsx index 478cef5f62..8f335afbf9 100644 --- a/components/providers/workflow/forms/launch-scan-form.tsx +++ b/components/providers/workflow/forms/launch-scan-form.tsx @@ -16,7 +16,7 @@ import { ProviderInfo } from "../../provider-info"; type FormValues = z.infer>; interface LaunchScanFormProps { - searchParams: { type: string; id: string; connected: boolean }; + searchParams: { type: string; id: string }; providerData: { data: { type: string; @@ -32,7 +32,6 @@ export const LaunchScanForm = ({ }: LaunchScanFormProps) => { const providerType = searchParams.type; const providerId = searchParams.id; - const connected = searchParams.connected; // const [apiErrorMessage, setApiErrorMessage] = useState(null); @@ -53,10 +52,12 @@ export const LaunchScanForm = ({ const isLoading = form.formState.isSubmitting; + const isConnected = providerData.data.attributes.connection.connected; + const onSubmitClient = async (values: FormValues) => { console.log({ values }, "values from test connection form"); - if (connected) { + if (isConnected) { console.log("connected"); } else { console.log("not connected"); diff --git a/components/providers/workflow/forms/test-connection-form.tsx b/components/providers/workflow/forms/test-connection-form.tsx index 5a0bc394c6..d18e926138 100644 --- a/components/providers/workflow/forms/test-connection-form.tsx +++ b/components/providers/workflow/forms/test-connection-form.tsx @@ -85,7 +85,7 @@ export const TestConnectionForm = ({ if (connected) { router.push( - `/providers/launch-scan?type=${providerType}&id=${providerId}&connected=${connected}`, + `/providers/launch-scan?type=${providerType}&id=${providerId}`, ); } }