Skip to content

Commit

Permalink
projects displaying issue fixed using circleci v1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Aashish-Upadhyay-101 committed Feb 13, 2023
1 parent 8dfc013 commit 90f5934
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 17 deletions.
24 changes: 8 additions & 16 deletions backend/src/integrations/apps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -336,21 +336,10 @@ const getAppsFlyio = async ({ accessToken }: { accessToken: string }) => {
const getAppsCircleci = async ({ accessToken }: { accessToken: string }) => {
// in place of accessToken we have to send Circle-Token i.e. Personal API token from CircleCi
let apps: any;
try {
const circleciOrganizationDetail = (
await axios.get(`${INTEGRATION_CIRCLECI_API_URL}/v2/me/collaborations`, {
headers: {
"Circle-Token": accessToken,
"Accept-Encoding": "application/json",
},
})
).data[0];

const { slug } = circleciOrganizationDetail;

const res = (
try {
let res = (
await axios.get(
`${INTEGRATION_CIRCLECI_API_URL}/v2/insights/${slug}/summary`,
`${INTEGRATION_CIRCLECI_API_URL}/v1.1/projects`,
{
headers: {
"Circle-Token": accessToken,
Expand All @@ -360,17 +349,20 @@ const getAppsCircleci = async ({ accessToken }: { accessToken: string }) => {
)
).data

apps = res?.all_projects?.map((a: any) => {
apps = res?.map((a: any) => {
return {
name: a
name: a?.reponame
}
})
} catch (err) {
console.log(err);
Sentry.setUser(null);
Sentry.captureException(err);
throw new Error("Failed to get Render services");
}

console.log("hello apps");

return apps;
};

Expand Down
2 changes: 1 addition & 1 deletion frontend/src/pages/integrations/circleci/create.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export default function CircleCICreateIntegrationPage() {
useEffect(() => {
// TODO: handle case where apps can be empty
if (integrationAuthApps) {
setTargetApp(integrationAuthApps[0].name);
setTargetApp(integrationAuthApps[0]?.name);
}
}, [integrationAuthApps]);

Expand Down

0 comments on commit 90f5934

Please sign in to comment.