mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-07 22:27:48 +00:00
projects displaying issue fixed using circleci v1.1
This commit is contained in:
@@ -337,20 +337,9 @@ const getAppsCircleci = async ({ accessToken }: { accessToken: string }) => {
|
|||||||
// in place of accessToken we have to send Circle-Token i.e. Personal API token from CircleCi
|
// in place of accessToken we have to send Circle-Token i.e. Personal API token from CircleCi
|
||||||
let apps: any;
|
let apps: any;
|
||||||
try {
|
try {
|
||||||
const circleciOrganizationDetail = (
|
let res = (
|
||||||
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 = (
|
|
||||||
await axios.get(
|
await axios.get(
|
||||||
`${INTEGRATION_CIRCLECI_API_URL}/v2/insights/${slug}/summary`,
|
`${INTEGRATION_CIRCLECI_API_URL}/v1.1/projects`,
|
||||||
{
|
{
|
||||||
headers: {
|
headers: {
|
||||||
"Circle-Token": accessToken,
|
"Circle-Token": accessToken,
|
||||||
@@ -360,17 +349,20 @@ const getAppsCircleci = async ({ accessToken }: { accessToken: string }) => {
|
|||||||
)
|
)
|
||||||
).data
|
).data
|
||||||
|
|
||||||
apps = res?.all_projects?.map((a: any) => {
|
apps = res?.map((a: any) => {
|
||||||
return {
|
return {
|
||||||
name: a
|
name: a?.reponame
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
console.log(err);
|
||||||
Sentry.setUser(null);
|
Sentry.setUser(null);
|
||||||
Sentry.captureException(err);
|
Sentry.captureException(err);
|
||||||
throw new Error("Failed to get Render services");
|
throw new Error("Failed to get Render services");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log("hello apps");
|
||||||
|
|
||||||
return apps;
|
return apps;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ export default function CircleCICreateIntegrationPage() {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
// TODO: handle case where apps can be empty
|
// TODO: handle case where apps can be empty
|
||||||
if (integrationAuthApps) {
|
if (integrationAuthApps) {
|
||||||
setTargetApp(integrationAuthApps[0].name);
|
setTargetApp(integrationAuthApps[0]?.name);
|
||||||
}
|
}
|
||||||
}, [integrationAuthApps]);
|
}, [integrationAuthApps]);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user