diff --git a/frontend/src/hooks/api/integrationAuth/queries.tsx b/frontend/src/hooks/api/integrationAuth/queries.tsx index e2783bfd33..f6aa83189b 100644 --- a/frontend/src/hooks/api/integrationAuth/queries.tsx +++ b/frontend/src/hooks/api/integrationAuth/queries.tsx @@ -8,9 +8,9 @@ import { BitBucketWorkspace, ChecklyGroup, Environment, + GithubRepository, IntegrationAuth, NorthflankSecretGroup, - GithubRepository, Org, Project, Service, @@ -343,7 +343,7 @@ const fetchIntegrationAuthBitBucketWorkspaces = async (integrationAuthId: string }; const fetchIntegrationAuthGitHubRepositories = async (integrationAuthId: string) => { - const { data: { repos } } = await apiRequest.get<{ workspaces: GithubRepository[] }>( + const { data: { repos } } = await apiRequest.get<{ repos: GithubRepository[] }>( `/api/v1/integration-auth/${integrationAuthId}/github-environment/repositories` ); return repos; diff --git a/frontend/src/pages/integrations/github-environment/create.tsx b/frontend/src/pages/integrations/github-environment/create.tsx index f7cfe1ea62..391362a8a8 100644 --- a/frontend/src/pages/integrations/github-environment/create.tsx +++ b/frontend/src/pages/integrations/github-environment/create.tsx @@ -17,8 +17,8 @@ import { } from "../../../components/v2"; import { useGetIntegrationAuthApps, - useGetIntegrationAuthGitHubRepositories, useGetIntegrationAuthById, + useGetIntegrationAuthGitHubRepositories, } from "../../../hooks/api/integrationAuth"; import { useGetWorkspaceById } from "../../../hooks/api/workspace"; @@ -27,7 +27,6 @@ export default function GitHubEnvironmentCreateIntegrationPage() { const { mutateAsync } = useCreateIntegration(); const [targetRepositoryId, setTargetRepositoryId] = useState(""); - const [targetRepositoryName, setTargetRepositoryName] = useState(""); const [targetEnvironmentId, setTargetEnvironmentId] = useState(""); const [selectedSourceEnvironment, setSelectedSourceEnvironment] = useState(""); @@ -59,24 +58,12 @@ export default function GitHubEnvironmentCreateIntegrationPage() { } }, [integrationAuthApps]); - // useEffect(() => { - // if (targetRepositories) { - // if (targetRepositories.length > 0) { - // setTargetRepositoryName(targetRepositories[0].name); - // } else { - // setTargetRepositoryName("none") - // } - // } - // }, [targetRepositoryId]); - useEffect(() => { if (targetRepositories) { if (targetRepositories.length > 0) { setTargetRepositoryId(targetRepositories[0].id); - setTargetRepositoryName(targetRepositories[0].name); } else { setTargetRepositoryId("none"); - setTargetRepositoryName("none") } } }, [targetRepositories]); @@ -87,9 +74,6 @@ export default function GitHubEnvironmentCreateIntegrationPage() { if (!integrationAuth?._id) return; - // const targetApp = integrationAuthApps?.find( - // (integrationAuthApp) => integrationAuthApp.appId === targetAppId - // ); const targetEnvironment = integrationAuthApps?.find( (app) => app.appId === targetEnvironmentId ); @@ -98,7 +82,6 @@ export default function GitHubEnvironmentCreateIntegrationPage() { (repository) => repository.id === targetRepositoryId ); - if (!targetRepository || !targetEnvironment) return; await mutateAsync({ integrationAuthId: integrationAuth?._id,