Skip to content

Commit

Permalink
github-env: fix lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Shraeyas committed Nov 26, 2023
1 parent ec109b4 commit 7d8c43a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 20 deletions.
4 changes: 2 additions & 2 deletions frontend/src/hooks/api/integrationAuth/queries.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import {
BitBucketWorkspace,
ChecklyGroup,
Environment,
GithubRepository,
IntegrationAuth,
NorthflankSecretGroup,
GithubRepository,
Org,
Project,
Service,
Expand Down Expand Up @@ -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;
Expand Down
19 changes: 1 addition & 18 deletions frontend/src/pages/integrations/github-environment/create.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ import {
} from "../../../components/v2";
import {
useGetIntegrationAuthApps,
useGetIntegrationAuthGitHubRepositories,
useGetIntegrationAuthById,
useGetIntegrationAuthGitHubRepositories,
} from "../../../hooks/api/integrationAuth";
import { useGetWorkspaceById } from "../../../hooks/api/workspace";

Expand All @@ -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("");
Expand Down Expand Up @@ -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]);
Expand All @@ -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
);
Expand All @@ -98,7 +82,6 @@ export default function GitHubEnvironmentCreateIntegrationPage() {
(repository) => repository.id === targetRepositoryId
);


if (!targetRepository || !targetEnvironment) return;
await mutateAsync({
integrationAuthId: integrationAuth?._id,
Expand Down

0 comments on commit 7d8c43a

Please sign in to comment.