mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-18 06:58:36 +00:00
36 lines
839 B
TypeScript
36 lines
839 B
TypeScript
import SecurityClient from '@app/components/utilities/SecurityClient';
|
|
|
|
interface Props {
|
|
integrationId: string;
|
|
appName: string;
|
|
environment: string;
|
|
}
|
|
|
|
/**
|
|
* This route starts the integration after teh default one if gonna set up.
|
|
* @param {*} integrationId
|
|
* @returns
|
|
*/
|
|
const startIntegration = ({ integrationId, appName, environment }: Props) =>
|
|
SecurityClient.fetchCall(`/api/v1/integration/${integrationId}`, {
|
|
method: 'PATCH',
|
|
headers: {
|
|
'Content-Type': 'application/json'
|
|
},
|
|
body: JSON.stringify({
|
|
update: {
|
|
app: appName,
|
|
environment,
|
|
isActive: true
|
|
}
|
|
})
|
|
}).then(async (res) => {
|
|
if (res && res.status === 200) {
|
|
return res;
|
|
}
|
|
console.log('Failed to start an integration');
|
|
return undefined;
|
|
});
|
|
|
|
export default startIntegration;
|